
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

This is basic tutorial for plotting or visualizing data in python using matplotlib library
In [1]: # importing libraries
%matplotlib inline import matplotlib.pyplot as plt import math
In [2]: x = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0] y = x y1 = [i ****** 2 for i in x] y2 = [i ****** 3 for i in x] y3 = [i + 0.5 for i in x]
In [3]: # plotting x verses y also we can plot multiple vectors in single plot, just add plots like below plt. plot(x,y) plt. plot(x,y1) plt. plot(x,y2) plt. plot(x,y3) plt. show()
In [4]: # if we want to see data points as markers on plot we will use different marker styles as below, markers are 'o','+','*' while
plt. plot(x,y,'o-',markersize = 15) plt. plot(x,y1,'+--') plt. plot(x,y2,'-') plt.* plot(x,y3,'d--')
plt. xlabel('X axis') plt. ylabel('Y axis') plt. title('Multiple plots in Single Figure') plt. grid(visible =True ) plt. show()
In [ ]: