PS backend wish list

The coordinates (80.640 31.680) are rendered twice; I can

    > comment one of these lines out of the PS file and the tick
    > still renders. Its not a bug in draw_markers, the square
    > data markers are only rendered once, it seems to be
    > specific to tickmarks.

Strange.... I'll look into this later.

    > I think we could get a performance boost if all similar
    > ticks were passed together to draw_markers, right now they
    > are passed independently.

We could, but it would require some redesign. Tick is a class, and
the axis contains a list of ticks. Thus it would take some top-level
redesign.

    > Yeah, I realized I had made a boneheaded observation just
    > after I hit the send button.

It's always that way :slight_smile: That is what the send button is for: self
enlightenment.

    > OK. Would you add the signature to backend_bases?

Not yet. I was just suggesting you use this internally.

    def draw_markers(self, gc, path, rgbFace, x, y, transform):

        self.push_gc(gc)

        while 1:
          .... snip...

and later when it becomes part of the api, you'll already have done
the hard part. You can also call this function from draw_ps.
Basically, all you need to do is rip the gc setting part of out of
draw_ps.

JDH

Hi John,

> I think we could get a performance boost if all
> similar ticks were passed together to draw_markers,
> right now they a are passed independently.

We could, but it would require some redesign. Tick is a
class, and the axis contains a list of ticks. Thus it would
take some top-level redesign.

I'd also encourage looking at how the Ticks are implemented. I
believe that for simple plots (say, simple_plot.py), the tick
drawing is what dominates rendering time, at least in the WxAgg
backend (which is dominated by the Agg rendering time). I
wouldn't be surprised if this was the case for most backends.

As far as I can tell, each tick mark is a separate Line2D with 2
points and have all the available properties of a Line2D. That
seems like a fine approach (certainly easy), but it's definitely
overkill. My speed tests say that rendering one thousand lines
with two points is a lot slower than rendering two lines with
one thousand points (easy enough to test). That means tick
drawing can easily be the performance bottleneck.

I like Darren's and Paul's suggestion (set line properties once,
then have the ticks be a simple list of pen up / pen down). I
believe major and minor ticks would need to have different
properties, but it's still only 2 set of properties. I
understand that this might mean a significant redesign, but the
performance boost might be worth it.

Thanks,

--Matt

PS: Someone might want tick marks to have all the flexibility
that they currently enjoy. My guess is that this would be
unusual (I don't see any examples that use this flexibility),
and that such cases could just add custom lines themselves.

···

On Mon, 4 Apr 2005, John Hunter wrote: