yampex.options.OptsBase(object)
class documentation
Part of yampex.options
(View In Hierarchy)
Known subclasses: yampex.plot.Plotter
Instance Variable | opts | A dict of options. |
Method | set | Before this subplot is drawn, do a set_name=value command
to the axes. You can call this method as many times as you like with a
different attribute name and value. |
Method | prevOpts | Lets you use my previous local options (or the current ones, if there are no previous ones) inside a context call. |
Method | add_annotation | Adds the text supplied after index k at an annotation of the plotted vector. |
Method | add_axvline | Adds a vertical dashed line at the data point with integer index k. You can use negative indices, e.g., -1 for the last data point. |
Method | add_color | Appends the supplied line style character to the list of colors being used. |
Method | add_legend | Adds the supplied format-substituted text to the list of legend entries. |
Method | add_line | Appends the supplied line style string(s) to my list of line styles being used. |
Method | add_lines | Alias for add_line . |
Method | add_marker | Appends the supplied marker style character to the list of markers being used. |
Method | add_plotKeyword | Add a keyword to the underlying Matplotlib plotting call. |
Method | add_textBox | Adds a text box to the specified location of the subplot. |
Method | clear_annotations | Clears the list of annotations. |
Method | clear_legend | Clears the list of legend entries. |
Method | clear_plotKeywords | Clears all keywords for this subplot. |
Method | clear_textBoxes | Clears the dict of text boxes. |
Method | plot | Specifies a non-logarithmic regular plot, unless called with the name of a different plot type. |
Method | plot_bar | Specifies a bar plot, unless called with False . |
Method | plot_error | Specifies an error bar plot, unless called with False . |
Method | plot_loglog | Makes both axes logarithmic, unless called with False . |
Method | plot_semilogx | Makes x-axis logarithmic, unless called with False . |
Method | plot_semilogy | Makes y-axis logarithmic, unless called with False . |
Method | plot_stem | Specifies a stem plot, unless called with False . |
Method | plot_step | Specifies a step plot, unless called with False . |
Method | set_axisExact | Forces the limits of the named axis ("x" or "y") to
exactly the data range, unless called with False . |
Method | set_colors | Sets the list of colors. Call with no args to clear the list and revert to default color scheme. |
Method | set_firstVectorTop | Has the first dependent vector (the second argument to the Plotter object call)
determine the top (maximum) of the displayed plot boundary. |
Method | set_fontsize | Sets the fontsize of the specified artist name. |
Method | set_legend | Sets the list of legend entries. |
Method | set_tickSpacing | Sets the major tick spacing for axisName ("x" or "y"), and minor tick spacing as well. |
Method | set_title | Sets a title for all subplots (if called out of context) or for just the present subplot (if called in context). |
Method | set_xlabel | Sets the x-axis label. |
Method | set_ylabel | Sets the y-axis label. |
Method | set_zeroBottom | Sets the bottom (minimum) of the Y-axis range to zero, unless called
with False . |
Method | set_zeroLine | Draws a horizontal line at the specified y value (default is y=0) if the Y-axis range includes that value. |
Method | use_bump | Bumps up the common y-axis upper limit to 120% of what Matplotlib
decides. Call with False to disable the bump. |
Method | use_grid | Adds a grid, unless called with False . |
Method | use_legend | Has an automatic legend entry added for each plot line, unless called
with False . |
Method | use_labels | Has annotation labels point to each plot line instead of a legend, with text taken from the legend list. (Works best in interactive apps.) |
Method | use_minorTicks | Enables minor ticks for axisName ("x" or "y",
omit for both). Call with False after the axisName to
disable. |
Method | use_timex | Uses intelligent time scaling for the x-axis, unless called with
False . |
Method | hide_axis | Hide the x-axis and y-axis (for images). |
Before this subplot is drawn, do a set_name=value
command
to the axes. You can call this method as many times as you like with a
different attribute name and value.
Use this method in place of calling the Plotter instance with keywords. Now, such keywords are sent directly to the underlying Matplotlib plotting call.
def prevOpts(self):
Lets you use my previous local options (or the current ones, if there are no previous ones) inside a context call.
Adds the text supplied after index k at an annotation of the plotted vector.
If there is more than one vector being plotted within the same subplot, you can have the annotation refer to a vector other than the first one by setting the keyword kVector to its non-zero index.
The annotation points to the point at index k of the plotted vector, unless k is a float. In that case, it points to the point where the vector is closest to that float value.
You may include a text prototype with format-substitution args following it, or just supply the final text string with no further arguments. If you supply just an integer or float value with no further arguments, it will be formatted reasonably.
You can set the annotation to the first y-axis value that crosses a
float value of k by setting y True
.
Note: Your code needs to make sure that you are really passing an integer value of k if that's what you intend. If it's a float, the annotation will go where you don't expect it to.
See Also | clear_annotations . |
Adds a vertical dashed line at the data point with integer index k. You can use negative indices, e.g., -1 for the last data point.
To place the dashed line at (or at least near) an x value, use a float for k.
Appends the supplied line style character to the list of colors being used.
The first and possibly only color in the list applies to the first
vector plotted within a given subplot. If there are additional vectors
being plotted within a given subplot (three or more arguments supplied when
calling the Plotter
object, more than the number of colors that have been added to the list,
then the colors rotate back to the first one in the list.
If you never call this and don't set your own list with a call to set_colors
,
a default color list is used.
If no color code or None
is supplied, reverts to the
default color scheme.
Adds the supplied format-substituted text to the list of legend entries.
You may include a text prototype with format-substitution args, or just supply the final text string with no further arguments.
See Also | clear_legend ,
set_legend . |
Appends the supplied line style string(s) to my list of line styles being used.
The first and possibly only line style in the list applies to the first
vector plotted within a given subplot. If there is an additional vector
being plotted within a given subplot (three or more arguments supplied when
calling the Plotter
object, and more than one line style has been added to the list, then the
second line style in the list is used for that second vector plot line.
Otherwise, the first (only) line style in the list is used for the second
plot line as well.
If no line style character or None
is supplied, clears the
list of line styles.
Parameters | width | A width for the line(s). If you want separate line widths for different lines, call this repeatedly with each seperate line style and width. (You can make the width a second argument of a 2-arg call, after a single line style string.) |
Appends the supplied marker style character to the list of markers being used.
The first and possibly only marker in the list applies to the first
vector plotted within a given subplot. If there is an additional vector
being plotted within a given subplot (three or more arguments supplied when
calling the Plotter
object, and more than one marker has been added to the list, then the
second marker in the list is used for that second vector plot line.
Otherwise, the first (only) marker in the list is used for the second plot
line as well.
You can specify a size for the marker as well.
Add a keyword to the underlying Matplotlib plotting call.
See Also | clear_plotKeywords . |
Adds a text box to the specified location of the subplot.
Here are the locations (you can use the integer instead of the abbreviation if you want), along with their text alignments:
- "NE": right, top.
- "E": right, middle.
- "SE": right, bottom.
- "S": middle, bottom.
- "SW": left, bottom.
- "W": left, middle.
- "NW": left, top.
- "N": middle, top.
- "M": middle of plot.
If there's already a text box at the specified location, a line will be added to it.
You may include a text prototype with format-substitution args, or just supply the final text string with no further arguments.
See Also | clear_textBoxes . |
Specifies a non-logarithmic regular plot, unless called with the name of a different plot type.
Forces the limits of the named axis ("x" or "y") to
exactly the data range, unless called with False
.
Sets the list of colors. Call with no args to clear the list and revert to default color scheme.
Supply a list of color codes, either as a single argument or with one entry per argument.
Has the first dependent vector (the second argument to the Plotter
object call)
determine the top (maximum) of the displayed plot boundary.
Sets the fontsize of the specified artist name.
Recognized names are 'title', 'xlabel', 'ylabel', 'legend', 'annotations', and 'textbox'.
Sets the list of legend entries.
Supply a list of legend entries, either as a single argument or with one entry per argument. You can set the fontsize keyword to the desired fontsize of the legend; the default is 'small'.
See Also | add_legend ,
clear_legend . |
Sets the major tick spacing for axisName ("x" or "y"), and minor tick spacing as well.
For each setting, an int
will set a maximum number of tick
intervals, and a float
will set a spacing between
intervals.
You can set minor True
to have minor ticks set
automatically, or False
to have them turned off. (Major ticks
are set automatically by default, and cannot be turned off.)
Sets a title for all subplots (if called out of context) or for just the present subplot (if called in context).
You may include a text prototype with format-substitution args, or just supply the final text string with no further arguments.
Sets the x-axis label.
Ignored if time-x mode has been activated with a call to
set_timex
. If called out of context, on the Plotter
instance, this
x-label is used for all subplots and only appears in the last (bottom)
subplot of each column of subplots.
Sets the bottom (minimum) of the Y-axis range to zero, unless called
with False
.
This is useful for plotting values that are never negative and where zero is a meaningful absolute minimum.
Draws a horizontal line at the specified y value (default is y=0) if the Y-axis range includes that value.
If y is None
or False
, clears any previously
set line.
Parameters | color | Set the line color (default: black). |
linestyle | Set the line type (default: '--'). | |
linewidth | Set the line width (default: 1). |
Bumps up the common y-axis upper limit to 120% of what Matplotlib
decides. Call with False
to disable the bump.
Adds a grid, unless called with False
.
The behavior this method is a little different than it used to be. You
can still enable a default grid by calling it with no arguments, or turn
off the grid entirely by supplying False
as that sole
argument. But now specifying a custom grid has become a lot more
powerful.
To turn gridlines on for just one axis's major tics, supply that axis
name as an argument followed by 'major'. (Not case-sensitive.) For example,
use_grid('x', 'major')
enables only vertical grid lines at
major tics of the 'x' axis.
To turn gridlines on for both major and minor ticks, use 'both', like
this: use_grid('both')
. Or, for major and minor ticks on just
the 'y' axis, for example, use_grid('y', 'both')
. You can also
use the term 'minor' to have grid lines just at minor ticks, though it's
not evident why you would want that as opposed to 'both'.
To have different grid lines for different axes, supply each axis name followed by its tick specifier. For example, to have horizontal grid lines at both major and minor ticks of the 'y' axis but vertical lines just at major tick locations on the 'x' axis, do this::
use_grid('x', 'both', 'y', 'major')
Has an automatic legend entry added for each plot line, unless called
with False
.
Has annotation labels point to each plot line instead of a legend, with text taken from the legend list. (Works best in interactive apps.)
Call with False
to revert to default legend-box
behavior.
Enables minor ticks for axisName ("x" or "y",
omit for both). Call with False
after the axisName to
disable.
To enable with a specific tick spacing, supply a float instead of just
True
. Or, for a specific number of ticks, supply that as an
int.
Note that, due to a Matplotlib limitation, you can't enable minor ticks for just one axis, although you can independently set the tick spacings.
Uses intelligent time scaling for the x-axis, unless called with
False
.
If your x-axis is for time with units in seconds, you can call this to have the X values rescaled to the most sensible units, e.g., nanoseconds for values < 1E-6. Any xlabel option is disregarded in such case because the x label is set automatically.