Hi John, Martin, I was experimenting with drawing markers
> one at a time for a ReadCursor class to provide the option
> of marking the position of the cursor. I saw this email and
> read the thread (the users mailing list is very helpful).
> Since markers and lines go together and implementing
> markers in the same way for ReadCursor would cause a lot of
> code duplication, I tried pulling out the relevant
> functions from lines.py and creating a Marker class -
> attached. A test function is below. I am using TkAgg, so
> _newstyle is True and renderer has draw_markers. x and y
> in Marker.__init__ are sequences and are turned into 1d
> arrays before passed to draw_markers. I get:
> Traceback (most recent call last): File "test_marker.py",
> line 9, in ? m.draw_marker(fcr) File
> line 556, in draw_marker markerFunc(renderer, gc, xt, yt)
> line 85, in _draw_pixel renderer.draw_markers(gc, path, xt,
> yt) IndexError: Unexpected SeqBase<T> length.
With newstyle, the signature of draw_markers is
draw_markers(gc, path, rgbFace, x, y, trans)
where x and y are not transformed and trans is an mpl transform.
Here is the docstring from backend_bases.py
def _draw_markers(self, gc, path, rgbFace, x, y, trans):
This method is currently underscore hidden because the
draw_markers method is being used as a sentinel for newstyle
path - a matplotlib.agg.path_storage instance
Draw the marker specified in path with graphics context gc at
each of the locations in arrays x and y. trans is a
matplotlib.transforms.Transformation instance used to
transform x and y to display coords. It consists of an
optional nonlinear component and an affine. You can access
these two components as
x,y = transform.nonlinear_only_numerix(x, y)
# the a,b,c,d,tx,ty affine which transforms x and y
vec6 = transform.as_vec6_val()
...backend dependent affine...
You may also want to search the dev archives for more elaborate
discussions. I'm short on time now so gotta run!