utils.draw.setFigure¶
Class · Decorator · Context · Source
mdnc.utils.draw.setFigure(
style=None, font_name=None, font_size=None, use_tex=None
)
A context decorator class, which is used for changing the figure's configurations locally for a specific function. Could be used by two different ways:
Example
1 2 3 4 5 | |
1 2 3 4 | |
Arguments¶
Requries
The following arguments would take effect only when they are configured explicitly.
| Argument | Type | Description |
|---|---|---|
style | str ordict orPath orlist | The local stylesheet of the figure. The details could be found in matplotlib.style.context. We could also find some examples here. |
font_name | str | The local font family name for the output figure. The specified font should be installed and available for any software. |
font_size | int | The local font size for the output figure. |
use_tex | bool | Whether to use LaTeX backend for the output figure. Recommend to enable it when drawing figures for a paper. |
Warning
If you are using a not installed or not supported font as font_name, the context decorator would not raise an error, but only show some warnings. This behavior is the same as matplotlib.
Warning
In the above argument list, the latter argument would override the former argument. For example, if some style has already specified font_size, configuring the argument font_size would override the configuration in the stylesheet. Please pay attention to your desired configurations.
Examples¶
As decorator
1 2 3 4 5 6 7 8 9 10 11 12 | |
As context
1 2 3 4 5 6 7 8 9 | |