Plotting FAQs
Contents
Plotting FAQs#
This page gathers frequently asked questions regarding the dantro plotting interface.
General
PlotManager
FAQsPlotHelper
FAQs
Aside from these FAQs, make sure to have a look at other plotting-related documentation pages.
Note
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?#
Yes.
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:
my_plot:
out_dir: ~/my/custom/output/directory
# ... the rest of the plot configuration
Note
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:
my_plot:
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?#
Yes.
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 configurationPass
exist_ok=True
to the plot creator during initialization
Note
If you always desire this behavior for a specific plot creator, set the
OUT_PATH_EXIST_OK
class variable toTrue
. That variable defines the default behavior. It is overwritten by theexist_ok
argument passed during initialization of aBasePlotCreator
(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 thePlotManager
. To suppress a warning, useoverwrite_nowarn
.
Can plots be skipped?#
Yes. See Skipping Plots for more information.
PlotHelper
FAQs#
Can I assign a custom figure to the PlotHelper?#
Yes.
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.