You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ENH]: Enable native tab support, with MultiCursor functionality (improvement on plotWindow) #23328
The program plotWindow allows several tabs to be created, and subplots within each tab.
The problem is that plotWindow seems unable to display a vertical cursor in several tabs, using MultiCursor.
Proposed solution
One solution could be to enable support for tabs natively within MatPlotLib. This would make it possible to use MultiCursor correctly for all subplots, and with all tabs.
Otherwise, if anyone has ideas about how to solve the problem of plotWindow integration with MatPlotLib (specifically, how to use a vertical cursor across subplots, and to allow this for all tabs), that would be fine if native tabs support is too hard.
@goobleplax this sort of thing is exactly why we don't support tabs. The interactions between canvases can be quite complex, and one use cases' idea of how it should work is different than another use case.
In this case, if one of the tabbed library authors has an upstream fix for us, we are happy to consider it, but the core library cannot guarantee and test that every widget works on every downstream library.
Matplotlib is foremost a library, but we supply simple apps to interact with the library (the interactive backends). Requests to expand the scope of those simple apps need to be weighed very carefully against our very limited maintenance ability, and the fact that such expansions need to be supported across an imposing matrix of backends and operating systems. Multi-tab only works with Qt, for instance. The tools that we do have get out of sync across backends, and/or break, and impose quite a maintenance burden.
Each tab is its own Figure/Canvas. MultiCursor only binds itself to one Canvas so it only sees mouse events from axes on in the figure that canvas is associated with.
The fix here is to add a check that all Axes are in the same Figure on init and raise otherwise.
While I haven't looked at the details, it should be possible (and hopefully easy) for MultiCursor to just loop over all canvases of all artists (both when connecting the callbacks, and in the callbacks implementations). mplcursors does something similar, e.g. registration over all canvases is at https://github.com/anntzer/mplcursors/blob/main/lib/mplcursors/_mplcursors.py#L256-L259.
Activity
QuLogic commentedon Jun 23, 2022
If you have a problem with plotWindow, I'm not sure why you reported it here and not to them.
Anyway, the tabbed view request is a duplicate of #2194.
goobleplax commentedon Jun 23, 2022
The problem isn't only with plotWindow.
Your mention of issue #2194 led me to the program mpl-multitab by @astromancer, mentioned here:
#2194 (comment)
The problem is reproduced there as well (MultiCursor only displays vertical cursor on the last tab).
So it seems to be an issue with MatPlotLib and/or implementation of MultiCursor.
jklymak commentedon Jun 23, 2022
@goobleplax this sort of thing is exactly why we don't support tabs. The interactions between canvases can be quite complex, and one use cases' idea of how it should work is different than another use case.
In this case, if one of the tabbed library authors has an upstream fix for us, we are happy to consider it, but the core library cannot guarantee and test that every widget works on every downstream library.
Matplotlib is foremost a library, but we supply simple apps to interact with the library (the interactive backends). Requests to expand the scope of those simple apps need to be weighed very carefully against our very limited maintenance ability, and the fact that such expansions need to be supported across an imposing matrix of backends and operating systems. Multi-tab only works with Qt, for instance. The tools that we do have get out of sync across backends, and/or break, and impose quite a maintenance burden.
Regardless, please carry on discussion in #2194.
tacaswell commentedon Jun 24, 2022
Each tab is its own Figure/Canvas. MultiCursor only binds itself to one Canvas so it only sees mouse events from axes on in the figure that canvas is associated with.
The fix here is to add a check that all Axes are in the same Figure on init and raise otherwise.
anntzer commentedon Jun 24, 2022
While I haven't looked at the details, it should be possible (and hopefully easy) for MultiCursor to just loop over all canvases of all artists (both when connecting the callbacks, and in the callbacks implementations). mplcursors does something similar, e.g. registration over all canvases is at https://github.com/anntzer/mplcursors/blob/main/lib/mplcursors/_mplcursors.py#L256-L259.