Temporarily modify the rc settings in a “with as” block.
mode ({0, 1, 2}
, optional) – The context mode. Dictates the behavior of find
, fill
, and category
within a “with as” block when called with context=True
.
The options are as follows:
mode=0
: Matplotlib’s rc_matplotlib
settings and proplot’s rc_proplot
settings are all returned, whether or not they are local to the “with as” block.
mode=1
: Matplotlib’s rc_matplotlib
settings are only returned if they are local to the “with as” block. For example, if rc['axes.titlesize']
was passed to context
, then pplt.rc.find('axes.titlesize', context=True)
will return this value, but pplt.rc.find('axes.titleweight', context=True)
will return None
. This is used internally when instantiating axes.
mode=2
: Matplotlib’s rc_matplotlib
settings and proplot’s rc_proplot
settings are only returned if they are local to the “with as” block. This is used internally when formatting axes.
Note
Context “modes” are primarily used internally but may also be useful for power users. Mode 1
is used when format
is called during axes instantiation, and mode 2
is used when format
is manually called by users. The latter prevents successive calls to format
from constantly looking up and re-applying unchanged settings and significantly increasing the runtime.
Example
The below applies settings to axes in a specific figure using context
.
>>> import proplot as pplt >>> with pplt.rc.context(ticklen=5, metalinewidth=2): >>> fig, ax = pplt.subplots() >>> ax.plot(data)
The below applies settings to a specific axes using format
, which uses context
internally.
>>> import proplot as pplt >>> fig, ax = pplt.subplots() >>> ax.format(ticklen=5, metalinewidth=2)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4