Skip to content

Plotting Scripts

Chris White edited this page Aug 18, 2018 · 10 revisions

Overview

Athena++ is bundled with several Python scripts designed to plot data generated by the code. These are meant to give users a quick and easy way to visualize the data, as well as to provide a launching point for development of more customized analysis tools for a given project.

The scripts are located in vis/python/. The are:

  • plot_lines.py, which makes line plots from .hst or .tab files;
  • plot_slice.py, which plots either 2D data or 2D slices of 3D data in .athdf files;
  • plot_spherical.py, which plots vertical or midplane slices of data in spherical coordinates, properly accounting for geometry.

The scripts are detailed below. All scripts can be run with the -h option to print usage help.

plot_lines.py

Usage: plot_lines.py <data_files> <x_names> <y_names> <output_file> [<options>]

Positional arguments:

  • data_files: comma-separated list of input files.
  • x_names: comma-separated list of abscissas.
  • y_names: comma-separated list of ordinates.
  • output_file: name of output to be (over)written; use show to show interactive plot instead.
  • Note: The first three arguments allow multiple quantities from multiple files to be overplotted. For convenience, the three lists are automatically extended to have the same length as the longest one. Any such extensions repeat the last given entry. Also, empty entries (i.e. no characters appearing between two commas) indicate the previous entry should be repeated.

Optional arguments:

  • -s, --styles: comma-separated list of line or marker styles, such as - or o; use the -s=... form of the argument if the first entry begins with a dash; empty entries are interpreted as solid lines.
  • -c, --colors: comma-separated list of color codes, such as k, blue, or #123abc; empty entries result in black (single line) or default color cycling (multiple lines).
  • -l, --labels: comma-separated list of labels for legend; empty entries are not added to legend; strings can include mathematical notation inside $...$.
  • --x_log: flag indicating x-axis should be log scaled.
  • --y_log: flag indicating y-axis should be log scaled.
  • --x_min: minimum for x-axis.
  • --x_max: maximum for x-axis.
  • --y_min: minimum for y-axis.
  • --y_max: maximum for y-axis.
  • --x_label: label to use for x-axis.
  • --y_label: label to use for y-axis.
  • Note: Empty entries in --styles, --colors, and --labels refer to no characters appearing between commas. For --styles and --colors the last entry is repeated as necessary to match the number of entries in the positional arguments.
Clone this wiki locally