The auto_plot function

/tmp/ipykernel_5324/1180289843.py:5: DeprecationWarning: `set_matplotlib_formats` is deprecated since IPython 7.23, directly use `matplotlib_inline.backend_inline.set_matplotlib_formats()`
  set_matplotlib_formats('retina')

Overview

The easiest way to plot stuff with vplot is using the vplot.auto_plot function. Given a path to a directory containing a vplanet run, vplot.auto_plot will parse the output and generate plots of all of the simulated quantities as a function of time for all of the bodies.

Let’s run vplot.auto_plot on the CircumbinaryOrbit example.

[3]:
import vplot

When we call vplot.auto_plot, we pass the directory to the vplanet run:

[4]:
vpl.auto_plot("examples/CircumbinaryOrbit")
WARNING: AstropyDeprecationWarning: support for accessing str attributes such as 'title' from PhysicalType instances is deprecated since 4.3 and will be removed in a subsequent release. [astropy.units.physical]

Note

You must actually run vplanet before calling vplot!

By default, parameters are grouped by parameter name. This means that if there are multiple bodies with the same parameter, they will all show up in the same plot, with labels indicating the body they correspond to. We can disable grouping by running

[5]:
vpl.auto_plot("examples/CircumbinaryOrbit", group="none")
WARNING: AstropyDeprecationWarning: support for accessing str attributes such as 'title' from PhysicalType instances is deprecated since 4.3 and will be removed in a subsequent release. [astropy.units.physical]

Alternatively, we can group by physical type. This means that everything that is an angle will be grouped into one plot, everything that has units of distance will be grouped into a different plot, and so forth. It isn’t always useful, particularly if you have lots of parameters of the same physical type (as is the case here).

[6]:
vpl.auto_plot("examples/CircumbinaryOrbit", group="type")
WARNING: AstropyDeprecationWarning: support for accessing str attributes such as 'title' from PhysicalType instances is deprecated since 4.3 and will be removed in a subsequent release. [astropy.units.physical]

Useful options

We can plot only specific parameters:

[7]:
vpl.auto_plot("examples/CircumbinaryOrbit", params=["eccentricity", "CBPR"])
WARNING: AstropyDeprecationWarning: support for accessing str attributes such as 'title' from PhysicalType instances is deprecated since 4.3 and will be removed in a subsequent release. [astropy.units.physical]

And we can plot only specific bodies:

[8]:
vpl.auto_plot("examples/CircumbinaryOrbit", params=["eccentricity", "CBPR"], bodies="earth")
WARNING: AstropyDeprecationWarning: support for accessing str attributes such as 'title' from PhysicalType instances is deprecated since 4.3 and will be removed in a subsequent release. [astropy.units.physical]

Note

Body and parameter names are case-insensitive, but otherwise they must match the values in the .in files exactly. Note that the parameter names are those specified in the saOutputOrder line of the .in files.

We can also plot things logarithmically:

[9]:
vpl.auto_plot("examples/CircumbinaryOrbit", params=["eccentricity", "CBPR"], bodies="earth", xlog=True, ylog=False)
WARNING: AstropyDeprecationWarning: support for accessing str attributes such as 'title' from PhysicalType instances is deprecated since 4.3 and will be removed in a subsequent release. [astropy.units.physical]

Finally, note that vplot.auto_plot also accepts any keyword arguments accepted by vplot.VPLOTFigure and matplotlib.figure.Figure, such as figsize and dpi.