3.1 Basic Concepts
1. Figure and Axes
fig = plt.figure()
ax = plt.axes()

2. Oriented Object

3. Pyplot
Last updated
fig = plt.figure()
ax = plt.axes()


Last updated
fig = plt.figure(figsize = (12,6)) # create a figure and set figure size
ax1= plt.axes() # create the first axes
ax2 = plt.axes([0.5, 0.5, 0.3, 0.3]) # create the second axes
ax3 = plt.axes([0.2,0.2,0.2,0.2]) # create the third axesfig, ax = plt.subplots() # Create a figure containing a single axes
x = np.linspace(0, 10, 100)
ax.plot(x, np.sin(x)) # plot a sine line on the axesplt.plot([1,2,3,4],[3,2,3,4]) # pyplot way