yampex.subplot.SpecialAx(object)
class documentation
Part of yampex.subplot
(View In Hierarchy)
I pretend to be the matplotlib.Axes
that I'm constructed
with except that I intercept plotting calls and have a few extra
methods.
The plotting calls are intercepted with a wrapper function and stored up
in my PlotHelper
where they can be processed all at once. The processing does the
following:
- Rescales the independent vector(s) if they are for time and there's a time unit (e.g., nanoseconds) scaling them.
-
Replace
container, *names
args with vectors in that container. - Plot with the next line style, marker style, and color if not specified in the call.
- Applies legends and annotations.
Construct me with a subplot axes object ax, an instance of Plotter
p, and my
integer subplot number (starts with 1). Or, construct me with an instance
of PlotHelper
.
If your call to a Plotter
instance (most
likely in a subplot context) has a container object as its first argument,
I will replace the arguments with actual Numpy vectors element-wise
accessed from that container object. The underlying Matplotlib call will
only see the Numpy vectors. For example,:
import numpy as np V = {'x': np.linspace(0, 1, 100)} V['y'] = V['x']**2 with Plotter(1) as sp: sp(V, 'x', 'y')
will plot the square of x vs x. This comes in handy when you have containers full of vectors and you want to plot selected ones of them in different subplots.
Instance Variable | helper | An instance of PlotHelper dedicated
to helping with my subplot. I either create a new instance or re-use one
supplied to my constructor. |
Method | __init__ | SpecialAx(ax, p, kSubplot) or
SpecialAx(helper) |
Method | ax | Property: Access the underlying Matplotlib Axes object
directly. |
Method | __getattr__ | Returns a plotting method of my _ax object, wrapped in a wrapper function, or the attribute of _ax directly for anything else. |
PlotHelper
dedicated
to helping with my subplot. I either create a new instance or re-use one
supplied to my constructor.
Returns a plotting method of my _ax object, wrapped in a wrapper function, or the attribute of _ax directly for anything else.
The wrapper looks up vector names from my vector container V (if
it's not a None
object), or from the first arg if that is a
vector container, applies per-plot keywords if not specified in the call,
and does x-axis scaling.