plt.figure()
时间: 2023-11-26 14:24:34 浏览: 97
This function is used to create a new figure object for plotting. It is a part of the matplotlib library in Python. When this function is called, a new empty figure object is created and can be customized with various plotting functions.
Syntax:
plt.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, FigureClass=<class 'matplotlib.figure.Figure'>, clear=False, **kwargs)
Parameters:
- num: integer or string, optional, default: None. A unique identifier for the figure, if not provided a new figure will be created with a default identifier.
- figsize: tuple of integers, optional, default: None. The width and height of the figure in inches. By default, the size of the figure is (6.4, 4.8).
- dpi: integer, optional, default: None. The resolution of the figure in dots per inch.
- facecolor: color or None, optional, default: None. The background color of the figure.
- edgecolor: color or None, optional, default: None. The color of the border around the figure.
- frameon: bool, optional, default: True. Whether or not to display the frame around the figure.
- FigureClass: class, optional, default: matplotlib.figure.Figure. The class of the figure object to create.
- clear: bool, optional, default: False. Whether or not to clear the figure before plotting.
- **kwargs: Additional keyword arguments that are passed to the figure class.
Returns:
- fig: matplotlib.figure.Figure object. The created figure object.
阅读全文