Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

PGF backend doesn't fire draw_event when not being used as the "primary" backend #2037

Closed
runiq opened this Issue · 6 comments

3 participants

@runiq

I don't know how to phrase this properly, so I wrote a tiny script that should exhibit the faulty behavior. I haven't tested other events yet.

The bug occurs whenever another backend is set first and the PGF backend is only switched to later, as per matplotlib.use() or an implicit or explicit call to plt.switch_backend().

@mdboom
Owner

Non-GUI backends, such as PGF, don't fire any events. What's your use case here? Maybe there's another way to achieve what you're trying to achieve.

@mdboom
Owner

Of course -- it is interesting that the Agg backend is firing an on_draw -- let me look into this a bit further...

@runiq

Non-GUI backends, such as PGF, don't fire any events.

Oh! Interesting, didn't know that. Of course, it does make sense since the events are probably intended for GUI use anyways.

Should I change the title of this issue then?

What's your use case here?

I noticed this while investigating issue #2040. I wrote a script to output a series of subplots whose yaxis labels I'd like to align in an automated fashion, and I need the current yaxis label positions to do that. However, the positions aren't known until the figure has been drawn first, so I added a callback to draw_event which I expected to fire on savefig().

I could probably just draw the figure first, get the label positions, and then do a savefig() without using the callback. If so, sorry for making noise in the tracker.

@pelson
Collaborator

@runiq - just checking, but do you know about shared axes? http://matplotlib.org/examples/pylab_examples/shared_axis_demo.html

@runiq

do you know about shared axes?

Yes, but I don't believe this applies for what I'm trying to do—the axes' ylims are different, which is why the yaxis labels are misaligned in the first place. IIRC, different ylims are not possible with a shared axis.

@mdboom
Owner

I'm removing the 1.3.x milestone on this -- I don't think there's an obvious way forward. @runiq: Please feel free to open a new issue to discuss the limitations of shared axis limits if there are some changes that would make sense for your use case.

@mdboom mdboom closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.