yampex.helper.PlotHelper(object)
class documentation
Part of yampex.helper
(View In Hierarchy)
I help with plotting calls for a single subplot.
Instance Variable | ax | The first and possibly only Matplotlib Axes object for the
subplot (a real one, not a SpecialAx instance)
for my subplot. (Will be the only one until twinning is supported.) |
Instance Variable | pairs | An instance of Pairs
containing Pair
instances, one for each X, Y pair of vectors defined by plotting calls made
on this subplot. (A single plotting call may define more than one X, Y
pair.) |
Method | __init__ | Undocumented |
Method | __getattr__ | You can access any of my Plotter object's
attributes as my own whose names don't conflict with those of my own
attributes. |
Method | arrayify | Returns the 1-D Numpy array form of X, if possible. |
Method | addCall | Parses the supplied args into X, Y pairs of vectors, appending a
Pair object for each to
my pairs list. |
Method | addLegend | Adds an annotation for a legend, putting it at the right-most point where the value is at least 99.9% of the vector maximum |
Method | pickPlotter | Returns a reference to the plotting method of my ax object named with call, modifying the supplied kw dict in-place as needed to work with that call. |
Method | plotVectors | Here is where I finally plot my X, Y vector pairs. |
Method | make_annotator | Constructs an instance of Annotator for the
current Axes object, returning a reference to it. |
Method | get_annotator | Returns the instance of Annotator that was
constructed for the current Axes object. |
Method | addAnnotations | Creates an Annotator for my
annotations to this subplot and then populates it. |
Method | doPlots | Does all my plotting and then the follow-up work for it. |
Method | _timeScaling | If the 'timex' option is set True , sets my subplot's x-axis
scaling to use the most appropriate time multiplier unit and sets that unit
name as the 'xlabel'. |
Axes
object for the
subplot (a real one, not a SpecialAx
instance)
for my subplot. (Will be the only one until twinning is supported.)
You can access any of my Plotter
object's
attributes as my own whose names don't conflict with those of my own
attributes.
Best to refer to p directly, though. This is a messy crutch.
Returns the 1-D Numpy array form of X, if possible.
If V is not None
and X is the key of an item
in V, replaces X with that item. Then, if it's not one
already, converts X to a 1-D Numpy array.
Returns a 3-tuple with (1) the 1-D Numpy array version of X or
its original value if it couldn't be converted to one, (2) its name or
None
if it was not an item of V, and (3) a boolean
True
if the result is a Numpy array.
If the 'timex' option is set True
, sets my subplot's x-axis
scaling to use the most appropriate time multiplier unit and sets that unit
name as the 'xlabel'.
Called by addCall
, with
the current subplot's local options.
Parses the supplied args into X, Y pairs of vectors, appending a
Pair
object for each to
my pairs list.
Pops the first arg and uses it as a container if it is a container
(e.g., a dict, not a Numpy array). Otherwise, refers to the V
attribute of my Plotter
p as a possible container. If there is indeed a container, and the
remaining args are all strings referencing items that are in it, makes the
remaining args into vectors.
Each item of the names list is a string with the name of a vector at the
same index of vectors, or None
if that vector was
supplied as-is and thus no name name was available.
Called with the next subplot's local options, so need to temporarily switch back to options for the current subplot, for the duration of this call.
Adds an annotation for a legend, putting it at the right-most point where the value is at least 99.9% of the vector maximum
Returns a reference to the plotting method of my ax object named with call, modifying the supplied kw dict in-place as needed to work with that call.
Here is where I finally plot my X, Y vector pairs.
TODO: Support yscale, last seen in commit #e20e6c15. Or maybe don't bother.
Constructs an instance of Annotator
for the
current Axes
object, returning a reference to it.
Returns the instance of Annotator
that was
constructed for the current Axes object.
Creates an Annotator
for my
annotations to this subplot and then populates it.
Twinned Axes
objects in a single subplot are not yet
supported (and may never be), so the annotator object is constructed with
my single Axes
object and operates only with that. That does
not mean that only a single vector can be annotated within one
subplot. Twinning is an unusual use case and multiple vectors typically
share the same Axes
object. An annotation can point its arrow
to any X,Y coordinate in the subplot, whether that is on a plotted curve or
not.
This method only adds the annotations, plopping them right on top of the
data points of interest. You need to call updateAnnotations
to
have them intelligently repositioned after the subplot has been completed
and its final dimensions are established, or (TODO) if it is resized
and the annotations need repositioning.