IndepOnlyBackend

class sherpa.plot.backends.IndepOnlyBackend(*args, **kwargs)[source] [edit on github]

Bases: BasicBackend

A backend that accepts only backend-independent options and arguments

This is meant for testing code and testing the documentation to ensure that examples only use backend independent options.

Attributes Summary

name

An easy-to-read string name

translate_dict

Dict of keyword arguments that need to be translated for this backend.

Methods Summary

as_html(data, fields)

Create HTML representation of a plot

as_html_cdf(plot)

as_html_contour1d(plot)

as_html_contour2d(plot)

as_html_data(plot)

as_html_datacontour(plot)

as_html_fit(plot)

as_html_fitcontour(plot)

as_html_histogram(plot)

as_html_lr(plot)

as_html_model(plot)

as_html_modelcontour(plot)

as_html_pdf(plot)

clear_window()

Provide empty plot window

colorlist(n)

Generate the list of n colors for use in multi-line plots.

contour(x0, x1, y, *[, levels, title, ...])

Draw contour lines.

get_cdf_plot_defaults()

get_component_histo_defaults()

get_component_plot_defaults()

get_confid_contour_defaults()

get_confid_plot_defaults()

get_confid_point_defaults()

get_contour_defaults()

get_data_contour_defaults()

get_data_plot_defaults()

get_fit_contour_defaults()

get_fit_plot_defaults()

get_histo_defaults()

get_html(attr)

get_image_defaults()

Currently, there are no configurable settings

get_latex_for_string(txt)

Convert LaTeX formula

get_model_contour_defaults()

get_model_histo_defaults()

get_model_plot_defaults()

get_plot_defaults()

get_point_defaults()

get_ratio_contour_defaults()

get_ratio_plot_defaults()

get_resid_contour_defaults()

get_resid_histo_defaults()

get_resid_plot_defaults()

get_rmf_plot_defaults()

get_scatter_plot_defaults()

get_split_plot_defaults()

histo(xlo, xhi, y, *[, yerr, title, xlabel, ...])

Display 1D histrogram

hline(y, *[, xmin, xmax, title, xlabel, ...])

Draw a horizontal line

image(x0, x1, y, *[, aspect, title, xlabel, ...])

Draw 2D image data.

initialize_plot(dataset, ids)

Create the plot window or figure for the given dataset.

plot(x, y, *[, xerr, yerr, title, xlabel, ...])

Draw x,y data.

select_plot(dataset, ids)

Select the plot window or figure for the given dataset.

set_jointplot(row, col, nrows, ncols[, ...])

Move to the plot, creating them if necessary.

set_subplot(row, col, nrows, ncols[, clearaxes])

Select a plot space in a grid of plots or create new grid

set_title(title)

Change the display title.

vline(x, *[, ymin, ymax, title, xlabel, ...])

Draw a vertical line

Attributes Documentation

name

An easy-to-read string name

translate_dict = {}

Dict of keyword arguments that need to be translated for this backend.

The keys in this dict are keyword arguments (e.g. 'markerfacecolor') and the values are one of the following:

  • A dict where the keys are the backend-independent values and the values are the values expressed for this backend. For values not listed in the dict, no translation is done.

  • A callable. The callable translation function is called with any argument given and allows the backend arbitrary translations. It should, at the very least, accept all backend independent values for this parameter without error.

Example:

>>> translate_dict = {'markerfacecolor': {'k': (0., 0., 0.)},
...                   'alpha': lambda a: 255 * a}

This translates the color ‘k’ to tuple of RGB values and alpha values to a number between 0 and 255.

Methods Documentation

as_html(data, fields) [edit on github]

Create HTML representation of a plot

Parameters:
  • data (Plot instance) – The plot object to display.

  • fields (sequence of strings) – The fields of data to use.

as_html_cdf(plot) [edit on github]
as_html_contour1d(plot) [edit on github]
as_html_contour2d(plot) [edit on github]
as_html_data(plot) [edit on github]
as_html_datacontour(plot) [edit on github]
as_html_fit(plot) [edit on github]
as_html_fitcontour(plot) [edit on github]
as_html_histogram(plot) [edit on github]
as_html_lr(plot) [edit on github]
as_html_model(plot) [edit on github]
as_html_modelcontour(plot) [edit on github]
as_html_pdf(plot) [edit on github]
clear_window() [edit on github]

Provide empty plot window

Depending on the backend, this may provide a new, empty window or clear the existing, current window.

colorlist(n) [edit on github]

Generate the list of n colors for use in multi-line plots.

Generally, the color will be ordered in some way and do not repeat or do so only after a large number of colors. Different backends might generate different lists of colors.

Parameters:

n (int) – Number of colors requested

Returns:

colors – list of color specifiers

Return type:

list

contour(x0, x1, y, *, levels=None, title=None, xlabel=None, ylabel=None, overcontour=False, clearwindow=True, xlog=False, ylog=False, label=None, colors=None, linestyles='solid', linewidths=None, alpha=None, **kwargs) [edit on github]

Draw contour lines.

Warning

No output will be produced by this backend, since the implementation is incomplete.

get_cdf_plot_defaults() [edit on github]
get_component_histo_defaults() [edit on github]
get_component_plot_defaults() [edit on github]
get_confid_contour_defaults() [edit on github]
get_confid_plot_defaults() [edit on github]
get_confid_point_defaults() [edit on github]
get_contour_defaults() [edit on github]
get_data_contour_defaults() [edit on github]
get_data_plot_defaults() [edit on github]
get_fit_contour_defaults() [edit on github]
get_fit_plot_defaults() [edit on github]
get_histo_defaults() [edit on github]
get_html(attr) [edit on github]
get_image_defaults() [edit on github]

Currently, there are no configurable settings

get_latex_for_string(txt) [edit on github]

Convert LaTeX formula

Parameters:

txt (str) – The text component in LaTeX form (e.g. r’lpha^2’). It should not contain any non-LaTeX content.

Returns:

latex – The text modified as appropriate for a backend so that the LaTeX will be displayed properly.

Return type:

str

get_model_contour_defaults() [edit on github]
get_model_histo_defaults() [edit on github]
get_model_plot_defaults() [edit on github]
get_plot_defaults() [edit on github]
get_point_defaults() [edit on github]
get_ratio_contour_defaults() [edit on github]
get_ratio_plot_defaults() [edit on github]
get_resid_contour_defaults() [edit on github]
get_resid_histo_defaults() [edit on github]
get_resid_plot_defaults() [edit on github]
get_rmf_plot_defaults() [edit on github]
get_scatter_plot_defaults() [edit on github]
get_split_plot_defaults() [edit on github]
histo(xlo, xhi, y, *, yerr=None, title=None, xlabel=None, ylabel=None, overplot=False, clearwindow=True, xlog=False, ylog=False, label=None, xerrorbars=False, yerrorbars=False, color=None, linestyle='solid', linewidth=None, marker='None', alpha=None, markerfacecolor=None, markersize=None, ecolor=None, capsize=None, **kwargs) [edit on github]

Display 1D histrogram

Warning

No output will be produced by this backend, since the implementation is incomplete.

hline(y, *, xmin=0, xmax=1, title=None, xlabel=None, ylabel=None, overplot=False, clearwindow=True, linecolor=None, linestyle=None, linewidth=None, **kwargs) [edit on github]

Draw a horizontal line

Warning

No output will be produced by this backend, since the implementation is incomplete.

Parameters:
  • y (float) – x position of the vertical line in data units

  • xmin (float, default=0) – Beginning of the horizontal line in axes coordinates, i.e. from 0 (left) to 1 (right).

  • xmax (float, default=1) – End of the vertical line in axes coordinates, i.e. from 0 (left) to 1 (right).

  • title (str, default=None) – Plot title (can contain LaTeX formulas). Only used if a new plot is created.

  • xlabel (str, default=None) – Axis label (can contain LaTeX formulas). Only used if a new plot is created.

  • ylabel (string, default=None) – Axis label (can contain LaTeX formulas). Only used if a new plot is created.

  • overplot (bool, default=False) – If True, the plot is added to an existing plot, if not a new plot is created.

  • clearwindow (bool, default=True) – If True the entire figure area is cleared to make space for a new plot.

  • linecolor (str, default=None) – The following colors are accepted by all backends: 'b' (blue), 'r' (red), 'g' (green), 'k' (black), 'w' (white), 'c' (cyan), 'y' (yellow), 'm' (magenta) but they may not translate to the exact same RGB values in each backend, e.g. 'b' could be a different shade of blue depending on the backend. Some backend might accept additional values.

  • linestyle (str, default=None) – The following values are accepted by all backends: 'noline', 'None' (as string, same as 'noline'), 'solid', 'dot', 'dash', 'dashdot', '-' (solid line), ':' (dotted), '--' (dashed), '-.' (dot-dashed), '' (empty string, no line shown), None (default - usually solid line). Some backends may accept additional values.

  • linewidth (float, default=None) – Thickness of the line.

  • kwargs (dict, optional) – All other keyword parameters are passed to the plotting library.

image(x0, x1, y, *, aspect=1, title=None, xlabel=None, ylabel=None, clearwindow=True, **kwargs) [edit on github]

Draw 2D image data.

Warning

This function is a non-functional dummy. The documentation is provided as a template only.

Parameters:
  • x0 (array-like) – independent axis in the first dimenation

  • x1 (array-like) – independent axis in the second dimenation

  • y (array-like, with shape (len(x0), len(x1))) – dependent axis (i.e. image values) in 2D with shape (len(x0), len(x1))

  • aspect (str or float, default=1) – Aspect ratio of the plot. Strings “equal” or “auto” are accepted.

  • title (str, default=None) – Plot title (can contain LaTeX formulas). Only used if a new plot is created.

  • xlabel (str, default=None) – Axis label (can contain LaTeX formulas). Only used if a new plot is created.

  • ylabel (string, default=None) – Axis label (can contain LaTeX formulas). Only used if a new plot is created.

  • clearwindow (bool, default=True) – If True the entire figure area is cleared to make space for a new plot.

  • kwargs (dict, optional) – All other keyword parameters are passed to the plotting library.

initialize_plot(dataset, ids) [edit on github]

Create the plot window or figure for the given dataset.

Warning

This function is a non-functional dummy. The documentation is provided as a template only.

Parameters:
  • dataset (str or int) – The dataset.

  • ids (array_like) – The identifier array from the DataStack object.

See also

select_plot

plot(x, y, *, xerr=None, yerr=None, title=None, xlabel=None, ylabel=None, xlog=False, ylog=False, overplot=False, clearwindow=True, label=None, xerrorbars=False, yerrorbars=False, color=None, linestyle='solid', linewidth=None, marker='None', alpha=None, markerfacecolor=None, markersize=None, ecolor=None, capsize=None, **kwargs) [edit on github]

Draw x,y data.

Warning

No output will be produced by this backend, since the implementation is incomplete.

select_plot(dataset, ids) [edit on github]

Select the plot window or figure for the given dataset.

The plot for this dataset is assumed to have been created.

Warning

This function is a non-functional dummy. The documentation is provided as a template only.

Parameters:
  • dataset (str or int) – The dataset.

  • ids (array_like) – The identifier array from the DataStack object.

See also

initialize_plot

set_jointplot(row, col, nrows, ncols, create=True, top=0, ratio=2) [edit on github]

Move to the plot, creating them if necessary.

Warning

This backend is a non-functional dummy. The documentation is provided as a template only.

Parameters:
  • row (int) – The row number, starting from 0.

  • col (int) – The column number, starting from 0.

  • nrows (int) – The number of rows.

  • ncols (int) – The number of columns.

  • create (bool, optional) – If True then create the plots

  • top (int) – The row that is set to the ratio height, numbered from 0.

  • ratio (float) – The ratio of the height of row number top to the other rows.

set_subplot(row, col, nrows, ncols, clearaxes=True, **kwargs) [edit on github]

Select a plot space in a grid of plots or create new grid

This method adds a new subplot in a grid of plots.

Warning

This backend is a non-functional dummy. The documentation is provided as a template only.

Parameters:
  • row (int) – index (starting at 0) of a subplot in a grid of plots

  • col (int) – index (starting at 0) of a subplot in a grid of plots

  • nrows (int) – Number of rows and column in the plot grid

  • ncols (int) – Number of rows and column in the plot grid

  • clearaxes (bool) – If True, clear entire plotting area before adding the new subplot.

Note

This method is intended for grids of plots with the same number of plots in each row and each column. In some backends, more complex layouts (e.g. one wide plot on row 1 and two smaller plots in row 2) might be possible.

set_title(title: str) None [edit on github]

Change the display title.

Parameters:

title (str) – The title text to use.

vline(x, *, ymin=0, ymax=1, title=None, xlabel=None, ylabel=None, overplot=False, clearwindow=True, linecolor=None, linestyle=None, linewidth=None, **kwargs) [edit on github]

Draw a vertical line

Warning

No output will be produced by this backend, since the implementation is incomplete.

Parameters:
  • x (float) – x position of the vertical line in data units

  • ymin (float, default=0) – Beginning of the vertical line in axes coordinates, i.e. from 0 (bottom) to 1 (top).

  • ymax (float, default=1) – End of the vertical line in axes coordinates, i.e. from 0 (bottom) to 1 (top).

  • title (str, default=None) – Plot title (can contain LaTeX formulas). Only used if a new plot is created.

  • xlabel (str, default=None) – Axis label (can contain LaTeX formulas). Only used if a new plot is created.

  • ylabel (string, default=None) – Axis label (can contain LaTeX formulas). Only used if a new plot is created.

  • overplot (bool, default=False) – If True, the plot is added to an existing plot, if not a new plot is created.

  • clearwindow (bool, default=True) – If True the entire figure area is cleared to make space for a new plot.

  • linecolor (str, default=None) – The following colors are accepted by all backends: 'b' (blue), 'r' (red), 'g' (green), 'k' (black), 'w' (white), 'c' (cyan), 'y' (yellow), 'm' (magenta) but they may not translate to the exact same RGB values in each backend, e.g. 'b' could be a different shade of blue depending on the backend. Some backend might accept additional values.

  • linestyle (str, default=None) – The following values are accepted by all backends: 'noline', 'None' (as string, same as 'noline'), 'solid', 'dot', 'dash', 'dashdot', '-' (solid line), ':' (dotted), '--' (dashed), '-.' (dot-dashed), '' (empty string, no line shown), None (default - usually solid line). Some backends may accept additional values.

  • linewidth (float, default=None) – Thickness of the line.

  • kwargs (dict, optional) – All other keyword parameters are passed to the plotting library.