Create a new figure. Parameters ---------- num : integer or string, optional, default: None If not provided, a new figure will be created, and the figure number will be incremented. The figure objects holds this number in a `number` attribute. If nu
(num=None, # autoincrement if None, else integer from 1-N
figsize=None, # defaults to rc figure.figsize
dpi=None, # defaults to rc figure.dpi
facecolor=None, # defaults to rc figure.facecolor
edgecolor=None, # defaults to rc figure.edgecolor
frameon=True,
FigureClass=Figure,
clear=False,
**kwargs
)
| 404 | ## Figures ## |
| 405 | |
| 406 | def figure(num=None, # autoincrement if None, else integer from 1-N |
| 407 | figsize=None, # defaults to rc figure.figsize |
| 408 | dpi=None, # defaults to rc figure.dpi |
| 409 | facecolor=None, # defaults to rc figure.facecolor |
| 410 | edgecolor=None, # defaults to rc figure.edgecolor |
| 411 | frameon=True, |
| 412 | FigureClass=Figure, |
| 413 | clear=False, |
| 414 | **kwargs |
| 415 | ): |
| 416 | """ |
| 417 | Create a new figure. |
| 418 | |
| 419 | Parameters |
| 420 | ---------- |
| 421 | |
| 422 | num : integer or string, optional, default: None |
| 423 | If not provided, a new figure will be created, and the figure number |
| 424 | will be incremented. The figure objects holds this number in a `number` |
| 425 | attribute. |
| 426 | If num is provided, and a figure with this id already exists, make |
| 427 | it active, and returns a reference to it. If this figure does not |
| 428 | exists, create it and returns it. |
| 429 | If num is a string, the window title will be set to this figure's |
| 430 | `num`. |
| 431 | |
| 432 | figsize : tuple of integers, optional, default: None |
| 433 | width, height in inches. If not provided, defaults to |
| 434 | :rc:`figure.figsize` = ``[6.4, 4.8]``. |
| 435 | |
| 436 | dpi : integer, optional, default: None |
| 437 | resolution of the figure. If not provided, defaults to |
| 438 | :rc:`figure.dpi` = ``100``. |
| 439 | |
| 440 | facecolor : |
| 441 | the background color. If not provided, defaults to |
| 442 | :rc:`figure.facecolor` = ``'w'``. |
| 443 | |
| 444 | edgecolor : |
| 445 | the border color. If not provided, defaults to |
| 446 | :rc:`figure.edgecolor` = ``'w'``. |
| 447 | |
| 448 | frameon : bool, optional, default: True |
| 449 | If False, suppress drawing the figure frame. |
| 450 | |
| 451 | FigureClass : subclass of `~matplotlib.figure.Figure` |
| 452 | Optionally use a custom `.Figure` instance. |
| 453 | |
| 454 | clear : bool, optional, default: False |
| 455 | If True and the figure already exists, then it is cleared. |
| 456 | |
| 457 | Returns |
| 458 | ------- |
| 459 | figure : `~matplotlib.figure.Figure` |
| 460 | The `.Figure` instance returned will also be passed to new_figure_manager |
| 461 | in the backends, which allows to hook custom `.Figure` classes into the |
| 462 | pyplot interface. Additional kwargs will be passed to the `.Figure` |
| 463 | init function. |