Plotting With Pyplot: This PDF Is Created at
Plotting With Pyplot: This PDF Is Created at
Importing PyPlot
Creating Line :
(a) Line Chart:
import matplotlib.pyplot as pl
A=[1,2,3,4]
B=[2,4,6,8]
pl.xlabel("Some Values")
pl.ylabel("Double Values")
pl.plot(A,B)
Example:
Example:
import matplotlib.pyplot as pl
A=[1,2,3,4]
B=[2,4,6,8]
pl.xlabel("Some Values")
pl.ylabel("Double Values")
pl.grid(True) # to on /Off the grid in chart
pl.plot(A,B,'r',linewidth=5,linestyle='dashed')
pl.show()
or
pl.plot(A,B,'c',marker="x",markersize=15, markeredgecolor='r',linewidth=5,linestyl
e='solid')
or
pl.plot(A,B,'r+', markeredgecolor='b', linestyle='solid')
or
pl.plot(A,B,'r+',markersize=25, markeredgecolor='b', linestyle='solid')
Color Code:
‘b’:Blue
‘g’:green
‘r’:red
‘m’:magenta
‘y’:yellow
‘k’:black
‘c’:cyan
‘w’:White
LineStyle:’solid’,’dashed’,’dashdot’,’dotted’
Linewidth: to set the line width of chart.