yampex.subplot.Subplotter(object)
class documentation
Part of yampex.subplot
(View In Hierarchy)
I handle your subplots, boundary setting and ticks. A Plotter
instance
constructs me with a reference to itself and an integer number of columns
and rows.
If you want one row (or multiple rows) to have twice the height of normal rows, supply its index in a sequence or set with the h2 constructor keyword. Similarly, if you want one column (or multiple columns) to have twice the width of normal columns, supply its index in a sequence or set with the w2 constructor keyword.
This is a convenient way to put emphasis on one or some subplots without making things overly complicated. And if you think you need a subplot to be more than twice as high or wide as the others, think again; your figure would look terrible.
TODO: Support axis twinning, and a subplot spanning multple columns in one row.
Parameters | h2 | A single index, or a sequence or set containing one or more indices, of any rows (starting with 0 for the top row) that have twice the normal height. If an invalid index is included, an exception will be raised. |
w2 | A single index, or a sequence or set containing one or more indices, of any columns (starting with 0 for the left column) that have twice the normal width. If an invalid index is included, an exception will be raised. |
Instance Variable | p | An instance of Plotter
that handles all subplots in a Matplotlib Figure . |
Instance Variable | N | Number of subplots (no greater than Nc*Nr). |
Instance Variable | Nc | Number of columns. |
Instance Variable | Nr | Number of rows. |
Method | __init__ | Undocumented |
Method | setup | Clears the figure and sets up a new set of subplots. |
Method | ax | The Axes object for the current subplot. |
Method | __iter__ | I can iterate over the Axes objects of subplots I've
generated so far. |
Method | __len__ | My length is the number of subplots I've generated so far. |
Method | __getitem__ | Returns the Axes object for my subplot with index k,
or the current one if k is None . |
Method | set_ | Performs a set_ call on my last-generated subplot, where
the first argument what is the suffix to the underlying
"set_" method and name is what is being set. |
Method | xBounds | Undocumented |
Method | yBounds | No summary |
Method | twinx | Creates and returns a twin of the last (or supplied) axes object. |
Method | getTwins | Returns a list of the twins for the last (or supplied) axes object, starting with the axes object itself and then the twins in the order they were created. |
Method | setTicks | Call with a dict defining ticks for 'x' and 'y' axes. Each axis has a sub-dict that may include 'major' and 'minor' entries. |
Method | kFix | If subplot index k is None , returns the index of the
current subplot, or the first one if there is not yet a current one. |
Method | onTop | Returns True if the current subplot (or one specified with
a subplot index k) will appear at the top of a column of
subplots. |
Method | atBottom | Returns True if the current subplot (or one specified with
a subplot index k) will appear at the bottom of a column of
subplots. |
Method | onLeft | Returns True if the current subplot (or one specified with
a subplot index k) will appear in the leftmost column of
subplots. |
Method | _doublings | Undocumented |
Returns the Axes
object for my subplot with index k,
or the current one if k is None
.
Performs a set_
call on my last-generated subplot, where
the first argument what is the suffix to the underlying
"set_" method and name is what is being set.
Any keywords to the setter method can be supplied.
Returns the result of the setter method call.
If bump is True
or Ymax is a value greater
than 95% of the largest y-value currently plotted, increases the upper
bound by 20%. If zeroBottom is set True
, anchors the
bottom to zero.
Creates and returns a twin of the last (or supplied) axes object.
Maintains a list of the twinned axes in the order they were created along with an index of the latest-created twin (for axes re-use).
TODO: Not yet supported!
Returns a list of the twins for the last (or supplied) axes object, starting with the axes object itself and then the twins in the order they were created.
TODO: Twinned axes are not yet supported! Always returns a single-element list.
Call with a dict defining ticks for 'x' and 'y' axes. Each axis has a sub-dict that may include 'major' and 'minor' entries.
Each entry, if present, defines the tick intervals. It can have one of four forms:
-
An
int
for a max number of tick intervals. -
A
float
for spacing between intervals. -
A
Bool
, justTrue
orFalse
to enable or disable ticks. (Major ticks are always enabled.) - A 2-sequence of floats containing (1) the spacing between intervals and (2) an anchor point that must have a tick, i.e., the starting point of intervals with ticks below and above it.
If subplot index k is None
, returns the index of the
current subplot, or the first one if there is not yet a current one.
Does not actually adjust kLast, just the returned value.
Returns the (possibly) fixed subplot index.
TODO: Fix this for use outside just the internal methods below.
Returns True
if the current subplot (or one specified with
a subplot index k) will appear at the top of a column of
subplots.
If there is just one subplot or one row of subplots, of course this will
return True
.