3.1 Data Visualization with Matplotlib (1)
3.1 Data Visualization with Matplotlib (1)
In [3]:
import matplotlib.pyplot as pl
import numpy as np
x_axis= np.array([0,10]) # create x axis using array
y_axis = np.array([0,100])
pl.plot(x_axis,y_axis)
pl.show()
Example 2: Draw a line with two points . First point(1,5) and second point (10,20
import matplotlib.pyplot as pl
import numpy as np
x_axis= np.array([1,10]) # create x axis using array
y_axis = np.array([5,20])
pl.plot(x_axis,y_axis,'o')
pl.show()
import matplotlib.pyplot as pl
import numpy as np
x_axis = np.array([1,5,8])
y_axis = np.array([3,2,9])
pl.plot(x_axis,y_axis)
pl.show()
Default x points
Example 6: Draw a line: y values are 5,1, 4, 8 ; Draw another line with values 2,9,7,4,5
Example 7: Draw a line: y values are 5,1, 4, 8 ; Draw another line with values 2,9,7,4,5
Out[33]:
Grid
In [3]:
import matplotlib.pyplot as plt
import numpy as np
a = np.array([20,30,40,50])
b= np.array([60.1, 45,34,67])
plt.plot(a,b)
plt.grid(axis='x',color = 'orange',linestyle='dashdot', linewidth=3.5)
plt.show()
subplot
In [5]:
plt.subplot(1,2,1)
plt.plot(a,b,marker='s')
plt.subplot(1,2,2)
plt.plot(x1,yaxis,marker='s')
plt.show()
In [17]:
Scatter plot
In [32]:
Out[32]:
[]
Bar plot
In [43]:
Histogram
In [1]:
Pie Chart
In [64]:
Box Plot
In [2]:
In [ ]: