lines = ax.plot(x,y)# Draw points with lines or markers connecting them
ax.scatter(x,y) #Draw unconnected points, scaled or colored
axes[0,0].bar([1,2,3],[3,4,5])# Plot vertical rectangles (constant width)
axes[1,0].barh([0.5,1,2.5],[0,1,2])# Plot horiontal rectangles (constant height)
axes[1,1].axhline(0.45) #Draw a horizontal line across axes
axes[0,1].axvline(0.65) #Draw a vertical line across axes
ax.fill(x,y,color='blue') #Draw filled polygons
ax.fill_between(x,y,color='yellow') #Fill between y-values and 0
axes[0,0].bar([1,2,3],[3,4,5]) # Plot vertical rectangles (constant width)
axes[1,0].barh([0.5,1,2.5],[0,1,2])# Plot horiontal rectangles (constant height)
axes[1,1].axhline(0.45) #Draw a horizontal line across axes
axes[0,1].axvline(0.65) #Draw a vertical line across axes
fig3
Vector Fields
object : subplot
method?func : arrow
attribution :
fig4, axes2 = plt.subplots(nrows=2,ncols=1) #axes is a array.
axes2[0].arrow(0,0,0.5,0.5)
axes2[1].quiver(y,z)
fig4
?plt.subplots().arrow
fig5, axes3=plt.subplots() # default : nrows=1,ncols=1
Y, X = np.mgrid[-3:3:100j, -3:3:100j]
U = -1 - X**2 + Y
V = 1 + X - Y**2
axes3.streamplot(X,Y,U,V)
fig5
Data Distributions
Plot a histogram
Make a box and whisker plot
e.g. X~N(1,4)
Make a violin plot
from numpy.random import randn
fig6, axes4=plt.subplots(nrows=3,ncols=1)
datay=randn(100)
axes4[0].hist(datay,bins=20,color='k',alpha=0.3) #Plot a histogram
axes4[1].boxplot(2*datay+1) #Make a box and whisker plot
axes4[2].violinplot(datay)
fig6