Options
- pytplot.options(name, option=None, value=None, opt_dict=None, quiet=False)[source]
Set a large variety of options for individual plots.
- Parameters:
name (
strorlist[str]) – Names of tplot variables to be updated (wildcards accepted).option (
str, optional) – The name of the option. See the options section below.value (
str,int,float,list, optional) – The value of the option. See the options section below.opt_dict (
dict, optional) – This can be a dictionary of option-value pairs. ‘option’ and ‘value’ will not be needed if this dictionary item is supplied.quiet (
bool, optional) – If True, do not complain about unrecognized options.
Options
Many of the options are passed directly to matplotlib calls. For more extensive documentation about how to use these obtions, see the matplotlib documentation: https://matplotlib.org/stable/users/index.html
Note that many X-axis options are controlled at the level of the entire plot, rather than per-variable (since plots with multiple panels will share many X axis properties). See the tplot_options() routine for available per-plot options,
Panel Options
Value type
Notes
title
str
The title of the plot.
panel_size
flt
Number between (0,1], representing the percent size of the plot.
alpha
flt
Number between [0,1], gives the transparency of the plot lines.
line_width
flt
Sets plot line width.
line_style
str
scatter (to make scatter plots), or solid_line, dot, dash, dash_dot, dash_dot_dot_dot, long_dash.
border
bool
Turns on or off the top/right axes that would create a box around the plot.
var_label_format
str
The format of the tick labels if this variable is displayed as an alternative x axis. Default: {:.2f}
char_size
int
Defines character size for x/y/z titles and subtitles
right_axis
bool
If true,display a second Y axis on the right side of the plot.
second_axis_size
numeric
The size of the second axis to display
data_gap
numeric
If there is a gap in the data larger than this number in seconds, then insert
annotations
dict
A dictionary or list of dictionaries of matplotlib text annotation parameters (see annotate() routine)
visible
bool
If False, do not display lines for this variable.
nodata
bool
If True, do not display lines for this variable.
(cont)
(cont)
NaNs. This is similar to using the degap procedure on the variable, but is
(cont)
(cont)
applied at plot-time, and does not persist in the variable data.
Legend Options
Value type
Notes
legend_names
list
A list of strings that will be used to identify the legends.
legend_location
str
A string giving the location of the legend box.
legend_size
numeric
The font size of the legend names
legend_shadow
bool
Turns on or off drop shadows on the legend box
legend_title
str
The title to display on the legend
legend_titlesize
numeric
The font size of the legend title
legend_color
[str]
The color of the legend names
legend_edgecolor
str
The border color of the legend box
legend_facecolor
str
The background color of the legend box
legend_markerfirst
boolean
Put the marker and line to the left of the label in the legend
legend_markerscale
numeric
The scale size of markers displayed in the legend
legend_linewidth
numeric
The width of the lines displayed in the legend
X Axis Options
Value type
Notes
xtitle
str
The title to be placed under the x axis.
xsubtitle
str
The subtitle to be placed under the x axis
xtitle_color
str
The color of the x axis title.
xtick_length
numeric
The length of the x tick marks
xtick_width
numeric
The width of the x tick marks
xtick_color
str
The color of the x tick marks
xtick_labelcolor
str
The color of the x tick marks
xtick_direction
str
The direction of the x tick marks (in, out, inout)
Y Axis Options
Value type
Notes
y_range
flt/list
Two numbers that give the y axis range of the plot. If a third argument is present, set linear or log scaling accordingly.
ylog
bool
True sets the y axis to log scale, False reverts.
ytitle
str
Title shown on the y axis. Use backslash for new lines.
ysubtitle
str
Subtitle shown on the y axis.
ytitle_color
str
The color of the y axis title.
ytick_length
numeric
The length of the Y tick marks
ytick_width
numeric
The width of the Y tick marks
ytick_color
str
The color of the Y tick marks
ytick_labelcolor
str
The color of the Y tick marks
ytick_direction
str
The direction of the Y tick marks (in, out, inout)
y_major_ticks
[numeric]
A list of values that will be used to set the major ticks on the Y axis.
y_minor_tick_interval
numeric
The interval between minor ticks on the Y axis.
Error Bar Options
Value type
Notes
errorevery
numeric
Interval at which to show error bars
capsize
numeric
The size of error bar caps
ecolor
str
The color of the error bar lines
elinewidth
numeric
The width of the error bar lines
Marker/Symbol Options
Value type
Notes
marker_size
numeric
The size of the markers displayed in the plot
markevery
numeric
Interval at which to show markers
symbols
bool
If True, display as a scatter plot (no lines)
Z / Specplot Options
Value type
Notes
spec
bool
Display this variable as a spectrogram.
colormap
str/list
Color map to use for specplots https://matplotlib.org/examples/color/colormaps_reference.html.
z_range
flt/list
Two numbers that give the z axis range of the plot. If a third argument is present, set linear or log scaling accordingly.
zlog
int
True sets the z axis to log scale, False reverts (spectrograms only).
ztitle
str
Title shown on the z axis. Spec plots only. Use backslash for new lines.
zsubtitle
str
Subtitle shown on the z axis. Spec plots only.
ztitle_color
str
The color of the z axis title.
x_interp
bool
If true, perform smoothing of spectrograms in the X direction
x_interp_points
numeric
Number of interpolation points to use in the X direction
y_interp
bool
If true, perform smoothing of spectrograms in the Y direction
y_interp_points
numeric
Number of interpolation points to use in the Y direction
xrange_slice
flt/list
Two numbers that give the x axis range of spectrogram slicing plots.
yrange_slice
flt/list
Two numbers that give the y axis range of spectrogram slicing plots.
xlog_slice
bool
Sets x axis on slice plot to log scale if True.
ylog_slice
bool
Sets y axis on slice plot to log scale if True.
spec_dim_to_plot
int/str
If variable has more than two dimensions, this sets which dimension the “v”
(cont)
(cont)
variable will display on the y axis in spectrogram plots.
(cont)
(cont)
All other dimensions are summed into this one, unless “spec_slices_to_use”
(cont)
(cont)
is also set for this variable.
spec_slices_to_use
str
Must be a dictionary of coordinate:values. If a variable has more than two
(cont)
(cont)
dimensions, spectrogram plots will plot values at that particular slice of
(cont)
(cont)
that dimension. See examples for how it works.
Many options have synonyms or variant spellings that are commonly used. The first column gives the name that is used throughout the plotting code. The second column gives the synonyms that are accepted.
Canonical name
Accepted synonyms
title
name
line_color
color, colors, col, cols, line_colors
legend_names
labels, legend_name, legend_label, legend_labels
legend_location
labels_location, legends_location, label_location, labels_location
legend_size
labels_size, label_size
legend_shadow
labels_shadow. label_shadow
legend_title
label_title, labels_title
legend_titlesize
lable_titlesize, labels_titlesize
legend_color
legends_color, label_color, labels_color
legend_edgecolor
label_edgecolor, labels_edgecolor
legend_facecolor
label_facecolor, labels_facecolor
legend_markerfirst
label_markerfirst, labels_markerfirst
legend_markerscale
label_markerscale, labels_markerscale
legend_linewidth
label_linewidth, labels_linewidth
legend_frameon
label_frameon, labels_frameon
legend_ncols
label_ncols, labels_ncols
line_style_name
line_style, linestyle
char_size
charsize
marker
markers
marker_size
markersize
markevery
markerevery mark_every marker_every
symbol
symbols
line_width
thick
y_range
yrange
z_range
zrange
data_gap
datagap
spec_dim_to_plot
spec_plot_dim
var_label_format
varlabel_format
annotations
annotation
- rtype:
Examples
>>> # Change the y range of Variable1 >>> import pyspedas >>> x_data = [1,2,3,4,5] >>> y_data = [1,2,3,4,5] >>> pyspedas.store_data("Variable1", data={'x':x_data, 'y':y_data}) >>> pyspedas.options('Variable1', 'yrange', [2,4])
>>> # Change Variable1 to use a log scale >>> pyspedas.options('Variable1', 'ylog', 1) >>> pyspedas.tplot('Variable1')
>>> # Multi-dimensional variable >>> y_data = np.random.rand(5, 4, 3) >>> v1_data = [0, 1, 3, 4] >>> v2_data = [1, 2, 3] >>> pyspedas.store_data("Variable2", data={'x': x_data, 'y': y_data, 'v1': v1_data, 'v2': v2_data}) >>> # Set the spectrogram plots to show dimension 'v2' at slice 'v1' = 0 >>> pyspedas.options('Variable2', 'spec', 1) >>> pyspedas.options("Variable2", "spec_dim_to_plot", 'v2') >>> pyspedas.options("Variable2", "spec_slices_to_use", {'v1': 0}) >>> pyspedas.tplot('Variable2')