Page 461 - AI Ver 3.0 class 10_Flipbook
P. 461
Marker Symbol Description Marker Symbol Description
"<" triangle_left "h" hexagon1
">" triangle_right "H" hexagon2
"1" tri_down "+" plus
"2" tri_up "x" X
"3" tri_left "x" x (filled)
"4" tri_right "D" diamond
We can either use character codes or the colour names as values to the parameter color in the plot().
Character Colour
'b' blue
"x" green
"r" red
"c" Cyan
"m" Magenta
"y" Yellow
"k" Black
"w" White
Linewidth and Line Style
The linewidth and linestyle property can be used to change the width and the style of the line chart. Linewidth is
specified in pixels. The default line width is 1 pixel showing a thin line. Thus, a number greater than 1 will output
a thicker line depending on the value provided. We can also set the line style of a line chart using the linestyle
parameter. It can take a string such as "solid", "dotted", "dashed" or "dashdot".
Let us now make some graphs:
Plotting a Line chart
• Single line chart
[1]: import matplotlib.pyplot as plt
city=['Delhi', 'Mumbai', 'Chennai', 'Kolkata' ]
temp=[35,21,40,22]
plt.xlabel('Metro Cities')
plt.ylabel('Temp in Celsius')
plt.xlabel('Metro Cities' )
plt. title ('Temprature Study of the Day')
plt.plot(city, temp, marker='*', markersize=10, color='red', linewidth=2,
linestyle='dashdot' )
plt. show()
Advance Python (Practical) 459

