Data Visual Iz
Data Visual Iz
pl.figure(figsize=(<width>,<length>))
import matplotlib.pyplot as pl
pl.figure(figsize=(15,7))
a=[1,2,3,4]
b=[2,4,6,8]
pl.plot(a,b)
pl.xlabel('find')
pl.ylabel('week')
pl.show()
import matplotlib.pyplot as pl
pl.grid(True)
a=[1,2,3,4]
b=[2,4,6,8]
pl.plot(a,b)
pl.xlabel('find')
pl.ylabel('week')
pl.show()
To change line color and style
<matplotlib.pyplot>.plot(<data1>,[,data2],<color code>)
To change line color and style
import matplotlib.pyplot as pl
pl.grid(True)
week=[1,2,3,4]
prices=[80,90,100,120]
pl.plot(week,prices,'y')
pl.xlabel('week')
pl.ylabel('Onion prices in Rs')
pl.show()
To change line width and line
style
linewidth=<width> specifies the width value in points
Linestyle or ls=[solid | ‘dashed’ , ’dashdot’ , ’dotted’ ]
Line styles
solid Solid line
Dashed Dashed line
Dotted Dotted line
dashdot Dashdotted line
Change marker type ,size and
color
The datapoints being plotted on a graph/chart are called markers.
marker=<valid marker type>,markersize=<in points> , markeredgecolor = <valid
color>
If you do not specify marker type,then data points will not be marked specifically
on the line chart and its default type will be the same as that of the line type.
markersize is specified in points
Markeredgecolor is a valid color.
Marker Description
‘ ,‘ Pixel marker
‘x‘ x marker
‘ h’ Hexagon 1 marker
pl.savefig("/content/drive/My Drive/python/diagram.png")