Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@docstrings.dedent
def _register_plotter(cls, identifier, module, plotter_name,
plotter_cls=None, summary='', prefer_list=False,
default_slice=None, default_dims={},
show_examples=True,
example_call="filename, name=['my_variable'], ...",
plugin=None):
"""
Register a plotter for making plots
This class method registeres a plot function for the :class:`Project`
class under the name of the given `identifier`
Parameters
----------
%(Project._register_plotter.parameters)s
@docstrings.dedent
def __init__(self, base, base_str, pattern='.+', pattern_base=None,
trace=False, replace=True):
"""
Parameters
----------
base: dict
base dictionary
%(SubDict.add_base_str.parameters.no_append)s
trace: bool
Default: False. If True, changes in the SubDict are traced back to
the `base` dictionary. You can change this behaviour also
afterwards by changing the :attr:`trace` attribute
replace: bool
Default: True. If True, everything but the '%%(key)s' part in a
base string is replaced (see examples below)
@docstrings.dedent
def save_project(self, fname=None, pwd=None, pack=False, **kwargs):
"""
Save this project to a file
Parameters
----------
fname: str or None
If None, the dictionary will be returned. Otherwise the necessary
information to load this project via the :meth:`load` method is
saved to `fname` using the :mod:`pickle` module
pwd: str or None, optional
Path to the working directory from where the data can be imported.
If None and `fname` is the path to a file, `pwd` is set to the
directory of this file. Otherwise the current working directory is
used.
pack: bool
@docstrings.dedent
def docs(self, *args, **kwargs):
"""
Show the available formatoptions in this project and their full docu
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Returns
-------
%(Plotter.show_keys.returns)s"""
@docstrings.dedent
def initialize_plot(self, data=None, ax=None, make_plot=True, clear=False,
draw=False, remove=False, priority=None):
"""
Initialize the plot for a data array
Parameters
----------
data: InteractiveArray or ArrayList, optional
Data object that shall be visualized.
- If not None and `plot` is True, the given data is visualized.
- If None and the :attr:`data` attribute is not None, the data in
the :attr:`data` attribute is visualized
- If both are None, nothing is done.
%(Plotter.parameters.ax|make_plot|clear)s
%(InteractiveBase.start_update.parameters.draw)s
@docstrings.dedent
def unshare(self, **kwargs):
"""
Unshare the formatoptions of all the plotters in this instance
This method uses the :meth:`psyplot.plotter.Plotter.unshare_me`
method to release the specified formatoptions in `keys`.
Parameters
----------
%(Plotter.unshare_me.parameters)s
See Also
--------
psyplot.plotter.Plotter.unshare, psyplot.plotter.Plotter.unshare_me"""
for plotter in self.plotters:
plotter.unshare_me(**kwargs)
@docstrings.dedent
def show_summaries(cls, keys=None, indent=0, *args, **kwargs):
"""
Classmethod to print the summaries of the formatoptions
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Returns
-------
%(Plotter.show_keys.returns)s
@docstrings.dedent
def show_keys(cls, keys=None, indent=0, grouped=False, func=None,
include_links=False, *args, **kwargs):
"""
Classmethod to return a nice looking table with the given formatoptions
Parameters
----------
%(Plotter._enhance_keys.parameters)s
indent: int
The indentation of the table
grouped: bool, optional
If True, the formatoptions are grouped corresponding to the
:attr:`Formatoption.groupname` attribute
Other Parameters
----------------
@docstrings.dedent
def share(self, base=None, keys=None, by=None, **kwargs):
"""
Share the formatoptions of one plotter with all the others
This method shares specified formatoptions from `base` with all the
plotters in this instance.
Parameters
----------
base: None, Plotter, xarray.DataArray, InteractiveList, or list of them
The source of the plotter that shares its formatoptions with the
others. It can be None (then the first instance in this project
is used), a :class:`~psyplot.plotter.Plotter` or any data object
with a *psy* attribute. If `by` is not None, then it is expected
that `base` is a list of data objects for each figure/axes
%(Plotter.share.parameters.keys)s
@docstrings.dedent
def _register_update(self, fmt={}, replot=False, force=False,
todefault=False):
"""
Register formatoptions for the update
Parameters
----------
fmt: dict
Keys can be any valid formatoptions with the corresponding values
(see the :attr:`formatoptions` attribute)
replot: bool
Boolean that determines whether the data specific formatoptions
shall be updated in any case or not.
%(InteractiveBase._register_update.parameters.force|todefault)s"""
if self.disabled:
return