NodeFigure

class grapheval.nodefigure.NodeFigure(default_format, **kwargs)

proplot.Figure wrapper for easy default-formatting of plots and addition of node_chains. Workflow: Create a NodeFigureFormat instance for each type of plot that you are about to create and pass it to a NodeFigure instance where needed. Change global parameters in the NodeFigure constructor and Subplot-special parameters by using NodeFigure[index].format()

default_format: an instance of NodeFigureFormat containing the defaults **kwargs: kwargs passed to Figure.format() and subsequently to all Axes.format()

__getitem__(key)
add(node_chain, to=None, instant=True, plot_on=None, memo=None, **kwargs)

Add a node_chain to the subplot given by to. If to is None (default) the node chain is added to every subplot in this figure. This is most useful for figures with only one subplot. Else to is interpreted as a slice for the SubplotGrid.__getitem__() method and the node_chain is added to all subplots returned by this call.

If instant is set to True the node_chain is executed in this function. If it is set to False the node_chain is scheduled to execute when calling savefig.

plot_this and memo are passed to the node chain, as well as all other kwargs. If memo is None the NodeFigure instance uses a memo list which is the same for every call with the same value of to.

property axs
execute()

Execute all remaining node_chains now.

property fig
property figure
format(*args, **kwargs)
pad(padding_factor, key=None, which='x')
savefig(path, legend_kw=None, legends_kw=None, fig_legend_kw=None, savefig_args=None)

Save figure to path (using savefig_args as kwargs for savefig) after adding a legend where applicable.

Node chains that have been added but not run are executed now.

legend_kw and legends_kw work exactly like NodeFigureFormat’s equally named parameters. If one is set for this method, NodeFigureFormat’s parameters are both overridden. See in NodeFigureFormat for more information. WARNING: At the moment those two parameters are ignored

show_nodes(path, figsize=(100, 60))

Generate a graph containing the parent tree of all nodes that have been attached to this figure and save it into path. Optionally tune the figsize.

class grapheval.nodefigure.SliceDict

A MutableMapping (behaving like a dict) that supports slices as keys.

class grapheval.nodefigure.NodeFigureFormat(base=None, subplots=None, fig_format=None, axs_format=None, ax_format=None, legend_kw=None, legends_kw=None, fig_legend_kw=None)

A set of format options for repeated use in NodeFigure instances.

base: another NodeFigureFormat instance which represents the base of this instance subplots: dict of args passed to Figure.add_subplots() fig_format: dict of args passed to Figure.format() and therefore may also apply

to all axes globally

ax_format: dict of args passed to SubplotGrid.format(), i.e. all Axes objects

is ignored if axs_format is not None

axs_format:
  • list of dicts with args passed to every subplot’s Axes.format() The SubplotGrid is seen as flattened array.

or * dict of dicts with args passed to every subplot Axes.format().

keys of the dict must be valid keys for the .__getitem__() method of the SubplotGrid instance returned with the given subplots parameters For example, if you set subplots to create a 3x3 grid, you can use all keys that yield items inside of this 3x3 grid. If you want to use slices as keys you may use the provided SliceDict class.

legend_kw: dict of args passed to Axes.legend() for all Axes objects. Ignored

if legends_kw is set.

legends_kw:
  • list of dicts with args passed to every subplot’s Axes.legend() The SubplotGrid is seen as flattened array.

or * dict of dicts with args passed to every subplot Axes.legend().

keys of the dict must be valid keys for the .__getitem__() method of the SubplotGrid instance returned with the given subplots parameters For example, if you set subplots to create a 3x3 grid, you can use all keys that yield items inside of this 3x3 grid. If you want to use slices as keys you may use the provided SliceDict class.

__getitem__(key)
class grapheval.nodefigure.NoLegend