Plotting API

class acispy.plots.DatePlot(ds, fields, field2=None, fmt='-b', lw=2, ls='-', ls2='-', lw2=2, fontsize=18, color=None, color2='magenta', figsize=10, 8, plot=None, fig=None, subplot=None, plot_bad=False)[source]

Make a single-panel plot of a quantity (or multiple quantities) vs. date and time.

Multiple quantities can be plotted on the left y-axis together if they have the same units, otherwise a quantity with different units can be plotted on the right y-axis.

Parameters
  • ds (Dataset) – The Dataset instance to get the data to plot from.

  • fields (tuple of strings or list of tuples of strings) – A single field or list of fields to plot on the left y-axis.

  • field2 (tuple of strings, optional) – A single field to plot on the right y-axis. Default: None

  • lw (float or list of floats, optional) – The width of the lines in the plots. If a list, the length of a the list must be equal to the number of fields. If a single number, it will apply to all plots. Default: 2 px.

  • ls (string, optional) – The line style of the lines plotted on the left y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • ls2 (string, optional) – The line style of the line plotted on the right y-axis. Can be a single linestyle or more than one for each line. Default: ‘-‘

  • lw2 (float, optional) – The width of the line plotted on the right y-axis.

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • color (list of strings, optional) – The colors for the lines plotted on the left y-axis. Can be a single color or more than one in a list. Default: Use the default Matplotlib order of colors.

  • color2 (string, optional) – The color for the line plotted on the right y-axis. Default: “magenta”

  • fig (Figure, optional) – A Figure instance to plot in. Default: None, one will be created if not provided.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

  • plot_bad (boolean, optional) – If True, “bad” values will be plotted but the ranges of bad values will be marked with translucent blue rectangles. If False, bad values will be removed from the plot. Default: False

Examples

>>> from acispy import DatePlot
>>> p1 = DatePlot(ds, ("msids", "1dpamzt"), field2=("states", "pitch"),
...               lw=2, color="brown")
>>> from acispy import DatePlot
>>> fields = [("msids", "1dpamzt"), ("msids", "1deamzt"), ("msids", "1pdeaat")]
>>> p2 = DatePlot(ds, fields, fontsize=12, color=["brown","black","orange"])
add_hline(y, lw=2, ls='-', color='green', xmin=None, xmax=None, **kwargs)

Add a horizontal line on the y-axis of the plot.

Parameters
  • y (float) – The value to place the vertical line at.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default: ‘green’

Examples

>>> p.add_hline(36., lw=3, ls='dashed', color='red')
add_hline2(y2, lw=2, ls='solid', color='green', **kwargs)[source]

Add a horizontal line on the right y-axis of the plot.

Parameters
  • y2 (float) – The value to place the vertical line at.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default: ‘green’

Examples

>>> p.add_hline2(105., lw=3, ls='dashed', color='red')
add_text(time, y, text, fontsize=18, color='black', rotation='horizontal', **kwargs)

Add text to a DatePlot.

Parameters
  • time (string) – The time to place the text at. Must be in YYYY:DOY:HH:MM:SS format.

  • y (float) – The y-value to place the text at.

  • text (string) – The text itself.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt.

  • color (string, optional) – The color of the font. Default: black.

  • rotation (string or float, optional) – The rotation of the text. Default: Horizontal

Examples

>>> dp.add_text("2016:101:12:36:10.102", 35., "Something happened here!",
...             fontsize=15, color='magenta')
add_vline(time, lw=2, ls='solid', color='green', **kwargs)

Add a vertical line on the time axis of the plot.

Parameters
  • time (string) – The time to place the vertical line at. Must be in YYYY:DOY:HH:MM:SS format.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default: ‘green’

Examples

>>> p.add_vline("2016:101:12:36:10.102", lw=3, ls='dashed', color='red')
annotate_obsids(ypos, ds=None, show_manuvrs=False, ywidth=2.0, txtheight=1.0, lw=2.0, fontsize=16, datestart=None, datestop=None, color='red', manuvr_color='blue', txtloc=0.5)

Annotate obsids on a CustomDatePlot or DatePlot instance. They will be annotated using lines to mark the beginning and end of obsids, and the actual obsid numbers will be marked on the plot.

Parameters
  • ypos (float) – The location on the y-axis at which the obsid lines will be annotated.

  • ds (Dataset, optional) – If this is a CustomDatePlot object, you will need to pass in a Dataset object to obtain the obsid information. Default: None

  • show_manuvrs (boolean, optional) – If True, obsid changes associated with maneuvers will be shown. Default: False

  • ywidth (float, optional) – The height of the lines marking obsid changes.

  • txtheight (float, optional) – The height in points where to place the text above the obsids line.

  • lw (float, optional) – The linewidth of the lines. Default: 2.0

  • fontsize (integer, optional) – The font size of the text.

  • datestart (string, optional) – Only show obsids after this date and time. Must be in the YYYY:DOY:HH:MM:SS format. Default is to show from the beginning of the plot.

  • datestop (string, optional) – Only show obsids before this date and time. Must be in the YYYY:DOY:HH:MM:SS format. Default is to show up to the end of the plot.

  • color (string, optional) – The color of the lines. Default: ‘red’

  • manuvr_color (string, optional) – The color of the lines for maneuver obsids. Default: ‘blue’

  • txtloc (float, optional) – A float between 0 and 1 to mark the location between the start and stop of the obsid where the obsid number is annotated.

fill_between(datestart, datestop, color, alpha=1.0)

Fill a shaded region between two times on the plot.

Parameters
  • datestart (string) – The beginning time of the shaded region. Must be in the YYYY:DOY:HH:MM:SS format.

  • datestop (string) – The ending time of the shaded region. Must be in the YYYY:DOY:HH:MM:SS format.

  • color (string) – The color of the shaded region.

  • alpha (float, optional) – The transparency of the shaded region. Default is 1.0, which is opaque.

plot_right(dates, values, fmt='-b', lw=2, fontsize=18, ls='-', color='magenta', **kwargs)

Plot a quantity on the right x-axis of this plot.

Parameters
  • dates (array of strings) – The dates to be plotted.

  • values (array) – The values to be plotted.

  • lw (float, optional) – The width of the lines in the plots. Default: 2 px.

  • ls (string, optional) – The line style of the line. Default: ‘-‘

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

redraw()

Re-draw the plot.

savefig(filename, **kwargs)

Save the figure to the file specified by filename.

set_field_label(field, label)[source]

Change the field label in the legend.

Parameters
  • field ((type, name) tuple) – The field whose label to change.

  • label – The label to set it to.

Examples

>>> dp.set_field_label(("msids","1deamzt"), "DEA Temperature")
set_grid(on)

Turn grid lines on or off on the plot.

Parameters

on (boolean) – Set to True to put the lines on, set to False to remove them.

set_legend(loc='best', fontsize=16, zorder=None, **kwargs)

Adjust a legend on the plot.

Parameters
  • loc (string, optional) – The location of the legend on the plot. Options are: ‘best’ ‘upper right’ ‘upper left’ ‘lower left’ ‘lower right’ ‘right’ ‘center left’ ‘center right’ ‘lower center’ ‘upper center’ ‘center’ Default: ‘best’, which will try to find the best location for the legend, e.g. away from plotted data.

  • fontsize (integer, optional) – The size of the legend text. Default: 16 pt.

Examples

>>> p.set_legend(loc='right', fontsize=18)
set_line_label(line, label)

Change the field label in the legend.

Parameters
  • line (integer) – The line whose label to change given by its number, assuming a starting index of 0.

  • label – The label to set it to.

Examples

>>> dp.set_line_label(1, "DEA Temperature")
set_title(label, fontsize=18, loc='center', **kwargs)

Add a title to the top of the plot.

Parameters
  • label (string) – The title itself.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

  • loc (string, optional) – The horizontal location of the title. Options are: ‘left’, ‘right’, ‘center’. Default: ‘center’

Examples

>>> p.set_title("my awesome plot", fontsize=15, loc='left')
set_xlim(xmin, xmax)

Set the limits on the x-axis of the plot to xmin and xmax, which must be in YYYY:DOY:HH:MM:SS format.

Examples

>>> p.set_xlim("2016:050:12:45:47.324", "2016:056:22:32:01.123")
set_ylabel(ylabel, fontsize=18, **kwargs)

Set the label of the left y-axis of the plot.

Parameters
  • ylabel (string) – The new label.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

Examples

>>> pp.set_ylabel("DPA Temperature", fontsize=15)
set_ylabel2(ylabel, fontsize=18, **kwargs)[source]

Set the label of the right y-axis of the plot.

Parameters
  • ylabel (string) – The new label.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

Examples

>>> p1.set_ylabel2("Pitch Angle in Degrees", fontsize=14)
set_ylim(ymin, ymax)[source]

Set the limits on the left y-axis of the plot to ymin and ymax.

set_ylim2(ymin, ymax)[source]

Set the limits on the right y-axis of the plot to ymin and ymax.

class acispy.plots.CustomDatePlot(dates, values, fmt='-b', lw=2, fontsize=18, ls='-', figsize=10, 8, color=None, plot=None, fig=None, subplot=None, **kwargs)[source]

Make a custom date vs. value plot.

Parameters
  • dates (array of strings) – The dates to be plotted.

  • values (array) – The values to be plotted.

  • lw (float, optional) – The width of the lines in the plots. Default: 2 px.

  • ls (string, optional) – The line style of the line. Default: ‘-‘

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

add_hline(y, lw=2, ls='-', color='green', xmin=None, xmax=None, **kwargs)[source]

Add a horizontal line on the y-axis of the plot.

Parameters
  • y (float) – The value to place the vertical line at.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default: ‘green’

Examples

>>> p.add_hline(36., lw=3, ls='dashed', color='red')
add_text(time, y, text, fontsize=18, color='black', rotation='horizontal', **kwargs)[source]

Add text to a DatePlot.

Parameters
  • time (string) – The time to place the text at. Must be in YYYY:DOY:HH:MM:SS format.

  • y (float) – The y-value to place the text at.

  • text (string) – The text itself.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt.

  • color (string, optional) – The color of the font. Default: black.

  • rotation (string or float, optional) – The rotation of the text. Default: Horizontal

Examples

>>> dp.add_text("2016:101:12:36:10.102", 35., "Something happened here!",
...             fontsize=15, color='magenta')
add_vline(time, lw=2, ls='solid', color='green', **kwargs)[source]

Add a vertical line on the time axis of the plot.

Parameters
  • time (string) – The time to place the vertical line at. Must be in YYYY:DOY:HH:MM:SS format.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default: ‘green’

Examples

>>> p.add_vline("2016:101:12:36:10.102", lw=3, ls='dashed', color='red')
annotate_obsids(ypos, ds=None, show_manuvrs=False, ywidth=2.0, txtheight=1.0, lw=2.0, fontsize=16, datestart=None, datestop=None, color='red', manuvr_color='blue', txtloc=0.5)[source]

Annotate obsids on a CustomDatePlot or DatePlot instance. They will be annotated using lines to mark the beginning and end of obsids, and the actual obsid numbers will be marked on the plot.

Parameters
  • ypos (float) – The location on the y-axis at which the obsid lines will be annotated.

  • ds (Dataset, optional) – If this is a CustomDatePlot object, you will need to pass in a Dataset object to obtain the obsid information. Default: None

  • show_manuvrs (boolean, optional) – If True, obsid changes associated with maneuvers will be shown. Default: False

  • ywidth (float, optional) – The height of the lines marking obsid changes.

  • txtheight (float, optional) – The height in points where to place the text above the obsids line.

  • lw (float, optional) – The linewidth of the lines. Default: 2.0

  • fontsize (integer, optional) – The font size of the text.

  • datestart (string, optional) – Only show obsids after this date and time. Must be in the YYYY:DOY:HH:MM:SS format. Default is to show from the beginning of the plot.

  • datestop (string, optional) – Only show obsids before this date and time. Must be in the YYYY:DOY:HH:MM:SS format. Default is to show up to the end of the plot.

  • color (string, optional) – The color of the lines. Default: ‘red’

  • manuvr_color (string, optional) – The color of the lines for maneuver obsids. Default: ‘blue’

  • txtloc (float, optional) – A float between 0 and 1 to mark the location between the start and stop of the obsid where the obsid number is annotated.

fill_between(datestart, datestop, color, alpha=1.0)[source]

Fill a shaded region between two times on the plot.

Parameters
  • datestart (string) – The beginning time of the shaded region. Must be in the YYYY:DOY:HH:MM:SS format.

  • datestop (string) – The ending time of the shaded region. Must be in the YYYY:DOY:HH:MM:SS format.

  • color (string) – The color of the shaded region.

  • alpha (float, optional) – The transparency of the shaded region. Default is 1.0, which is opaque.

plot_right(dates, values, fmt='-b', lw=2, fontsize=18, ls='-', color='magenta', **kwargs)[source]

Plot a quantity on the right x-axis of this plot.

Parameters
  • dates (array of strings) – The dates to be plotted.

  • values (array) – The values to be plotted.

  • lw (float, optional) – The width of the lines in the plots. Default: 2 px.

  • ls (string, optional) – The line style of the line. Default: ‘-‘

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (10, 8)

  • plot (DatePlot or CustomDatePlot, optional) – An existing DatePlot to add this plot to. Default: None, one will be created if not provided.

redraw()

Re-draw the plot.

savefig(filename, **kwargs)

Save the figure to the file specified by filename.

set_grid(on)

Turn grid lines on or off on the plot.

Parameters

on (boolean) – Set to True to put the lines on, set to False to remove them.

set_legend(loc='best', fontsize=16, zorder=None, **kwargs)[source]

Adjust a legend on the plot.

Parameters
  • loc (string, optional) – The location of the legend on the plot. Options are: ‘best’ ‘upper right’ ‘upper left’ ‘lower left’ ‘lower right’ ‘right’ ‘center left’ ‘center right’ ‘lower center’ ‘upper center’ ‘center’ Default: ‘best’, which will try to find the best location for the legend, e.g. away from plotted data.

  • fontsize (integer, optional) – The size of the legend text. Default: 16 pt.

Examples

>>> p.set_legend(loc='right', fontsize=18)
set_line_label(line, label)[source]

Change the field label in the legend.

Parameters
  • line (integer) – The line whose label to change given by its number, assuming a starting index of 0.

  • label – The label to set it to.

Examples

>>> dp.set_line_label(1, "DEA Temperature")
set_title(label, fontsize=18, loc='center', **kwargs)

Add a title to the top of the plot.

Parameters
  • label (string) – The title itself.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

  • loc (string, optional) – The horizontal location of the title. Options are: ‘left’, ‘right’, ‘center’. Default: ‘center’

Examples

>>> p.set_title("my awesome plot", fontsize=15, loc='left')
set_xlim(xmin, xmax)[source]

Set the limits on the x-axis of the plot to xmin and xmax, which must be in YYYY:DOY:HH:MM:SS format.

Examples

>>> p.set_xlim("2016:050:12:45:47.324", "2016:056:22:32:01.123")
set_ylabel(ylabel, fontsize=18, **kwargs)

Set the label of the left y-axis of the plot.

Parameters
  • ylabel (string) – The new label.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

Examples

>>> pp.set_ylabel("DPA Temperature", fontsize=15)
set_ylim(ymin, ymax)

Set the limits on the left y-axis of the plot to ymin and ymax.

class acispy.plots.MultiDatePlot(ds, fields, subplots=None, fontsize=15, lw=2, figsize=12, 12, color=None, plot_bad=False)[source]

Make a multi-panel plot of multiple quantities vs. date and time.

Parameters
  • ds (Dataset) – The Dataset instance to get the data to plot from.

  • fields (list of tuples of strings) – A list of fields to plot.

  • subplots (tuple of integers, optional) – The gridded layout of the plots, i.e. (num_x_plots, num_y_plots) The default is to have all plots stacked vertically.

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 15 pt.

  • lw (float, optional) – The width of the lines in the plots. Default: 2 px.

  • color (string, optional) – The color of the lines in the plots. Can be a single color or one color for each plot. Default is to use a single color, which is the Matplotlib default.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (12, 12)

  • plot_bad (boolean, optional) – If True, “bad” values will be plotted but the ranges of bad values will be marked with translucent blue rectangles. If False, bad values will be removed from the plot. Default: False

Examples

>>> from acispy import MultiDatePlot
>>> fields = [("msids", "1deamzt"), ("model", "1deamzt"), ("states", "ccd_count")]
>>> mp = MultiDatePlot(ds, fields, lw=2, subplots=(2, 2))
>>> from acispy import MultiDatePlot
>>> fields = [[("msids", "1deamzt"), ("model", "1deamzt")], ("states", "ccd_count")]
>>> mp = MultiDatePlot(ds, fields, lw=2)
add_vline(x, lw=2, ls='-', color='green', **kwargs)[source]

Add a vertical line on the time axis of the plot.

Parameters
  • time (string) – The time to place the vertical line at. Must be in YYYY:DOY:HH:MM:SS format.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default: ‘green’

Examples

>>> p.add_vline("2016:101:12:36:10.102", lw=3, ls='dashed', color='red')
redraw()[source]

Re-draw the plot.

savefig(filename, **kwargs)[source]

Save the figure to the file specified by filename.

set_grid(on)[source]

Turn grid lines on or off on the plot.

Parameters

on (boolean) – Set to True to put the lines on, set to False to remove them.

set_title(label, fontsize=18, loc='center', **kwargs)[source]

Add a title to the top of the plot.

Parameters
  • label (string) – The title itself.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

  • loc (string, optional) – The horizontal location of the title. Options are: ‘left’, ‘right’, ‘center’. Default: ‘center’

Examples

>>> p.set_title("my awesome plot", fontsize=15, loc='left')
set_xlim(xmin, xmax)[source]

Set the limits on the x-axis of the plot to xmin and xmax, which must be in YYYY:DOY:HH:MM:SS format.

class acispy.plots.PhaseScatterPlot(ds, x_field, y_field, c_field=None, fontsize=18, color='blue', cmap='hot', figsize=12, 12, plot=None, **kwargs)[source]

Make a single-panel phase scatter plot of one quantity vs. another.

The one restriction is that the two fields must have an equal amount of samples, achievable by interoplating one field to another’s times or creating a fake MSID field from a state field using map_state_to_msid().

Parameters
  • ds (Dataset) – The Dataset instance to get the data to plot from.

  • x_field (tuple of strings) – The field to plot on the x-axis.

  • y_field (tuple of strings) – The field to plot on the y-axis.

  • c_field (tuple of strings, optional) – The field to use to color the dots on the plot. Default: None

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • color (string, optional) – The color of the dots on the phase plot. Only used if a color field is not provided. Default: ‘blue’

  • cmap (string, optional) – The colormap for the dots if a color field has been provided. Default: ‘heat’

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (12, 12)

  • plot (PhasePlot, optional) – An existing PhasePlot to add this plot to. Default: None, one will be created if not provided.

Examples

>>> from acispy import PhaseScatterPlot
>>> pp = PhaseScatterPlot(ds, ("msids", "1deamzt"), ("msids", "1dpamzt"))
add_hline(y, lw=2, ls='-', color='green', **kwargs)

Add a horizontal line on the y-axis of the plot.

Parameters
  • y (float) – The value to place the vertical line at.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default: ‘green’

Examples

>>> p.add_hline(36., lw=3, ls='dashed', color='red')
add_line(x, y, lw=2, ls='-', color=None, **kwargs)

Add an arbitrary line to the plot.

Parameters
  • x (float) – The x-values of the line.

  • y (float) – The y-values of the line.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default is to use the default Matplotlib color.

Examples

>>> x = np.linspace(0.0, 50.0, 100)
>>> y = x.copy()
>>> p.add_line(x, y, lw=3, ls='dashed', color='red')
add_text(x, y, text, fontsize=18, color='black', rotation='horizontal', **kwargs)

Add text to a PhasePlot.

Parameters
  • x (string) – The x-value to place the text at.

  • y (float) – The y-value to place the text at.

  • text (string) – The text itself.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt.

  • color (string, optional) – The color of the font. Default: black.

  • rotation (string or float, optional) – The rotation of the text. Default: Horizontal

Examples

>>> dp.add_text(32.7, 35., "This spot is interesting",
...             fontsize=15, color='magenta')
add_vline(x, lw=2, ls='-', color='green', **kwargs)

Add a vertical line on the x-axis of the plot.

Parameters
  • x (float) – The value to place the vertical line at.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default: ‘green’

Examples

>>> p.add_vline(25., lw=3, ls='dashed', color='red')
redraw()

Re-draw the plot.

savefig(filename, **kwargs)

Save the figure to the file specified by filename.

set_grid(on)

Turn grid lines on or off on the plot.

Parameters

on (boolean) – Set to True to put the lines on, set to False to remove them.

set_title(label, fontsize=18, loc='center', **kwargs)

Add a title to the top of the plot.

Parameters
  • label (string) – The title itself.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

  • loc (string, optional) – The horizontal location of the title. Options are: ‘left’, ‘right’, ‘center’. Default: ‘center’

Examples

>>> p.set_title("my awesome plot", fontsize=15, loc='left')
set_xlabel(xlabel, fontsize=18, **kwargs)

Set the label of the x-axis of the plot.

Parameters
  • xlabel (string) – The new label.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

Examples

>>> pp.set_xlabel("DEA Temperature", fontsize=15)
set_xlim(xmin, xmax)

Set the limits on the x-axis of the plot to xmin and xmax.

set_ylabel(ylabel, fontsize=18, **kwargs)

Set the label of the left y-axis of the plot.

Parameters
  • ylabel (string) – The new label.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

Examples

>>> pp.set_ylabel("DPA Temperature", fontsize=15)
set_ylim(ymin, ymax)

Set the limits on the left y-axis of the plot to ymin and ymax.

class acispy.plots.PhaseHistogramPlot(ds, x_field, y_field, x_bins, y_bins, scale='linear', cmap='hot', fontsize=18, figsize=12, 12, plot=None, **kwargs)[source]

Make a single-panel 2D binned histogram plot of one quantity vs. another.

The one restriction is that the two fields must have an equal amount of samples, achievable by interoplating one field to another’s times or creating a fake MSID field from a state field using map_state_to_msid().

Parameters
  • ds (Dataset) – The Dataset instance to get the data to plot from.

  • x_field (tuple of strings) – The field to plot on the x-axis.

  • y_field (tuple of strings) – The field to plot on the y-axis.

  • x_bins (int or NumPy array) – The bins for the x-axis of the histogram. If an int, it will make that many bins between the minimum and maximum values. If a NumPy array, it will use it as the bin edges.

  • y_bins (int or NumPy array) – The bins for the y-axis of the histogram. If an int, it will make that many bins between the minimum and maximum values. If a NumPy array, it will use it as the bin edges.

  • scale (string, optional) – The scaling of the plot. “linear” or “log”. Default: “linear”

  • cmap (string, optional) – The colormap for the histogram. Default: ‘heat’

  • fontsize (integer, optional) – The font size for the labels in the plot. Default: 18 pt.

  • figsize (tuple of integers, optional) – The size of the plot in (width, height) in inches. Default: (12, 12)

  • plot (PhasePlot, optional) – An existing PhasePlot to add this plot to. Default: None, one will be created if not provided.

Examples

>>> from acispy import PhaseHistogramPlot
>>> pp = PhaseHistogramPlot(ds, "1deamzt", "1dpamzt", 100, 100)
add_hline(y, lw=2, ls='-', color='green', **kwargs)

Add a horizontal line on the y-axis of the plot.

Parameters
  • y (float) – The value to place the vertical line at.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default: ‘green’

Examples

>>> p.add_hline(36., lw=3, ls='dashed', color='red')
add_line(x, y, lw=2, ls='-', color=None, **kwargs)

Add an arbitrary line to the plot.

Parameters
  • x (float) – The x-values of the line.

  • y (float) – The y-values of the line.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default is to use the default Matplotlib color.

Examples

>>> x = np.linspace(0.0, 50.0, 100)
>>> y = x.copy()
>>> p.add_line(x, y, lw=3, ls='dashed', color='red')
add_text(x, y, text, fontsize=18, color='black', rotation='horizontal', **kwargs)

Add text to a PhasePlot.

Parameters
  • x (string) – The x-value to place the text at.

  • y (float) – The y-value to place the text at.

  • text (string) – The text itself.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt.

  • color (string, optional) – The color of the font. Default: black.

  • rotation (string or float, optional) – The rotation of the text. Default: Horizontal

Examples

>>> dp.add_text(32.7, 35., "This spot is interesting",
...             fontsize=15, color='magenta')
add_vline(x, lw=2, ls='-', color='green', **kwargs)

Add a vertical line on the x-axis of the plot.

Parameters
  • x (float) – The value to place the vertical line at.

  • lw (integer, optional) – The width of the line. Default: 2

  • ls (string, optional) – The style of the line. Can be one of: ‘solid’, ‘dashed’, ‘dashdot’, ‘dotted’. Default: ‘solid’

  • color (string, optional) – The color of the line. Default: ‘green’

Examples

>>> p.add_vline(25., lw=3, ls='dashed', color='red')
redraw()

Re-draw the plot.

savefig(filename, **kwargs)

Save the figure to the file specified by filename.

set_grid(on)

Turn grid lines on or off on the plot.

Parameters

on (boolean) – Set to True to put the lines on, set to False to remove them.

set_title(label, fontsize=18, loc='center', **kwargs)

Add a title to the top of the plot.

Parameters
  • label (string) – The title itself.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

  • loc (string, optional) – The horizontal location of the title. Options are: ‘left’, ‘right’, ‘center’. Default: ‘center’

Examples

>>> p.set_title("my awesome plot", fontsize=15, loc='left')
set_xlabel(xlabel, fontsize=18, **kwargs)

Set the label of the x-axis of the plot.

Parameters
  • xlabel (string) – The new label.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

Examples

>>> pp.set_xlabel("DEA Temperature", fontsize=15)
set_xlim(xmin, xmax)

Set the limits on the x-axis of the plot to xmin and xmax.

set_ylabel(ylabel, fontsize=18, **kwargs)

Set the label of the left y-axis of the plot.

Parameters
  • ylabel (string) – The new label.

  • fontsize (integer, optional) – The size of the font. Default: 18 pt

Examples

>>> pp.set_ylabel("DPA Temperature", fontsize=15)
set_ylim(ymin, ymax)

Set the limits on the left y-axis of the plot to ymin and ymax.