fig, ax = plt.subplots()
时间: 2023-11-06 12:28:59 浏览: 39
This code creates a figure object and an axis object. The figure object is the top-level container for all the plot elements, while the axis object represents the coordinate system of the plot. The axis object is where you actually plot your data.
You can modify the figure and axis objects using a variety of methods and properties, such as changing the size of the figure, adding titles or labels, adjusting the axis limits or ticks, and so on.
Once you have created the figure and axis objects, you can start plotting your data by calling various plotting functions on the axis object. For example, you might use ax.plot() to plot a line, ax.scatter() to plot a scatter plot, or ax.hist() to plot a histogram.