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

runiq opened this Issue May 21, 2013 · 6 comments


None yet
3 participants

runiq commented May 21, 2013

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 commented May 21, 2013

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 commented May 21, 2013

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

runiq commented May 21, 2013

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 commented May 22, 2013

@runiq - just checking, but do you know about shared axes?

runiq commented May 22, 2013

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 commented May 28, 2013

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 May 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment