Plotting FAQs#

This page gathers frequently asked questions regarding the dantro plotting interface.

Aside from these FAQs, make sure to have a look at other plotting-related documentation pages.


If you would like to add a question here, we are happy about contributions! Please visit the project page to open an issue or get more information about contributing.

General PlotManager FAQs#

Can I create plots in a specific directory?#


To write plots to a custom output directory (other than the associated output directory of the PlotManager), simply specify the out_dir argument in the plot configuration.

The file extension of the plot can also be specified there, using the file_ext key. Example:

  out_dir: ~/my/custom/output/directory

  # ... the rest of the plot configuration


You can only specify a directory here, not a full path; the full file path will be generated by the plot manager by adding the name of the plot and potentially existing sweep configurations to it.

If a relative path is given for out_dir, it will be relative to the output directory of the associated DataManager.

How can I specify a file extension?#

The file extension used in generating the output path can be adjusted for all plots associated with a plot creator or for a single plot, using its plot configuration.

To set a default extension, use the default_ext argument to BasePlotCreator or derived classes. To specify it for a single plot, use the file_ext argument, directly in its plot configuration:

  file_ext: pdf

  # ... the rest of the plot configuration

Also have a look at Plot Configuration Reference.

Can I allow plots to be overwritten instead of raising an error?#


Follow these steps to achieve overwriting of existing plot output:

  • Tell the plot creator that it should not raise an error if a file already exists at the generated output path:

    • Pass exist_ok=True in the plot configuration

    • Pass exist_ok=True to the plot creator during initialization


    If you always desire this behavior for a specific plot creator, set the OUT_PATH_EXIST_OK class variable to True. That variable defines the default behavior. It is overwritten by the exist_ok argument passed during initialization of a BasePlotCreator (or derived creator) and by the value given in the plot configuration.

  • Tell the plot manager to overwrite existing plot configuration files that are stored alongside each plot; otherwise, this would also create conflict. To do so, pass cfg_exists_action='overwrite' during the initialization of the PlotManager. To suppress a warning, use overwrite_nowarn.

Can plots be skipped?#

Yes. See Skipping Plots for more information.

PlotHelper FAQs#

Can I assign a custom figure to the PlotHelper?#


When using the PlotHelper, it automatically sets up a figure instance and an axis initially, even before the plot function is called. However, they can be replaced using the attach_figure_and_axes() method.

Can I let the plot function decide whether to perform an animation?#

Yes. See Dynamically entering/exiting animation mode for more information.