<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Oops, revisiting this thread now, it looks like I only replied to Ben, instead of the list. Full thread below, but TL;DR: my 3D orthogonal views project:
<div><br /></div>
<div>https://github.com/jni/mpl-volume-viewer</div>
<div><br /></div>
<div>is working (thanks to all on this list who helped so far!), but has the following problems:</div>
<div>- Experiences flickering when panning in the Tk backend</div>
<div>- Has no flickering with the MacOS backend, but then the keyboard bindings don’t work at all</div>
<div>- Is dog-slow in the nbagg backend.</div>
<div><br /></div>
<div>Any suggestions to help with this would be much appreciated! To recap, here are the steps to reproduce:</div>
<div><br /></div>
<div>
<div>- Download slice_view.py and put it in your PYTHONPATH or current working directory</div>
<div>- Download this example dataset: </div>
<div>https://www.dropbox.com/s/dj3oarx7bqx4us2/E_z2_512_1um_CONTROL.tif?dl=1</div>
<div>- Run this code:</div>
<div><br /></div>
<div><i>import matplotlib</i></div>
<div><i>matplotlib.use('TkAgg’)  # change this to whatever you want to test</i></div>
<div><i><br /></i></div>
<div><i>from skimage import io</i></div>
<div><i>import slice_view as sv</i></div>
<div><i><br /></i></div>
<div><i>filename = '/path/to/E_z2_512_1um_CONTROL.tif'</i></div>
<div><i>image = io.imread(filename) / 4096</i></div>
<div><i><br /></i></div>
<div><i>v = sv.SliceViewer(image, spacing=[5, 1, 1])</i></div>
<div><i>matplotlib.pyplot.show(block=True)</i></div>
</div>
<div><br /></div>
<div><br /></div>
<div>Thanks!</div>
<div><br /></div>
<div>Juan.</div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
---------- Forwarded message ----------<br />
<b>From:</b> Juan Nunez-Iglesias <jni.soma@gmail.com><br />
<b>Date:</b> 11 Jul 2017, 12:06 PM +1000<br />
<b>To:</b> Benjamin Root <ben.v.root@gmail.com><br />
<b>Subject:</b> Re: [Matplotlib-users] Subplot x-axis shared with other subplots y-axis<br />
<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Hi Ben, thanks for the tip! The point of using the ToolManager would be to get cross-backend support, so it might be easier for me to implement the backends I want with if-else statements, or some other kludgey way…
<div><br /></div>
<div>I just thought I’d update the list with the status of my orthogonal views mini-project, which is backend-dependent:</div>
<div><br /></div>
<div>- working on Tk except for the flickering</div>
<div>- working on macOS except the keyboard bindings don’t work — they go straight to the Terminal.</div>
<div>- working on Notebook (Nbagg?), except it’s dog-slow.</div>
<div><br /></div>
<div>If anyone has suggestions for any of these problems, I would be very grateful!</div>
<div><br /></div>
<div>Juan.</div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
On 28 Jun 2017, 1:08 AM +1000, Benjamin Root <ben.v.root@gmail.com>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">
<div dir="ltr">re: cross-backend way to add buttons: There is experimental feature called "ToolManager", but I think it is only implemented for a couple of backends currently. You can see an example here:<br />
<br />
<a href="http://matplotlib.org/examples/user_interfaces/toolmanager.html">http://matplotlib.org/examples/user_interfaces/toolmanager.html</a><br /></div>
<div class="gmail_extra"><br />
<div class="gmail_quote">On Fri, Jun 23, 2017 at 12:17 AM, Juan Nunez-Iglesias <span dir="ltr"><<a href="mailto:jni.soma@gmail.com" target="_blank">jni.soma@gmail.com</a>></span> wrote:<br />
<blockquote class="gmail_quote" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #3498db;">
<div>
<div name="messageBodySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif">Hey Tom,
<div><br /></div>
<div>Thanks for that response, it was just what I needed! I had a fun infinite loop where the x-axis was updating the y-axis which was updating the x-axis which... =P But it was easy enough to sort out. =)</div>
<div><br /></div>
<div>I have a working orthogonal slice viewer here:</div>
<div><a href="https://github.com/jni/mpl-volume-viewer/" target="_blank">https://github.com/jni/mpl-<wbr />volume-viewer/</a><br /></div>
<div><br /></div>
<div>The problem I have now is that, if I set a mouse-click callback (<a href="https://github.com/jni/mpl-volume-viewer/blob/6d863d2a28ced54576c6f4f8905d58e229f02042/slice_view.py#L71" target="_blank">this line</a> and <a href="https://github.com/jni/mpl-volume-viewer/blob/6d863d2a28ced54576c6f4f8905d58e229f02042/slice_view.py#L101" target="_blank">this line</a>), and then I select any other tool from the toolbar, I get this super-obnoxious flickering, recorded here (macOS 10.12, Tk backend):</div>
<div><a href="https://www.dropbox.com/s/qvfmgp0x36p6rb9/mpl-click-bug.mov?dl=0" target="_blank">https://www.dropbox.com/s/<wbr />qvfmgp0x36p6rb9/mpl-click-bug.<wbr />mov?dl=0</a><br /></div>
<div><br /></div>
<div>To reproduce:</div>
<div><br /></div>
<div>- Download slice_view.py and put it in your PYTHONPATH or current working directory</div>
<div>- Download this example dataset: </div>
<div><a href="https://www.dropbox.com/s/dj3oarx7bqx4us2/E_z2_512_1um_CONTROL.tif?dl=1" target="_blank">https://www.dropbox.com/s/<wbr />dj3oarx7bqx4us2/E_z2_512_1um_<wbr />CONTROL.tif?dl=1</a><br /></div>
<div>- Run this code:</div>
<div><br /></div>
<div>
<div><i>import matplotlib</i></div>
<div><i>matplotlib.use('TkAgg')</i></div>
<div><i><br /></i></div>
<div><i>from skimage import io</i></div>
<div><i>import slice_view as sv</i></div>
<div><i><br /></i></div>
<div><i>filename = '/path/to/E_z2_512_1um_<wbr />CONTROL.tif'</i></div>
<div><i>image = io.imread(filename) / 4096</i></div>
<div><i><br /></i></div>
<div><i>v = sv.SliceViewer(image, spacing=[5, 1, 1])</i></div>
<div><i>matplotlib.pyplot.show(block=<wbr />True)</i></div>
</div>
<div><br /></div>
<div>Questions:</div>
<div>1) Any ideas about how to fix the flickering?</div>
<div>2) Is there a cross-backend way to add buttons to the toolbar? All the examples I've found online were backend-specific. (This way I could at least disable the callback at will.)</div>
<div><br /></div>
<div>Thanks!</div>
<div><span class="HOEnZb"><font color="#888888"><br /></font></span></div>
<div><span class="HOEnZb"><font color="#888888">Juan.</font></span></div>
</div>
<div>
<div class="h5">
<div name="messageReplySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif"><br />
On 16 May 2017, 1:43 AM +1000, Thomas Caswell <<a href="mailto:tcaswell@gmail.com" target="_blank">tcaswell@gmail.com</a>>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #d35400;">
<div dir="ltr">There are callbacks that fire when the limits are changed.  See
<div><br /></div>
<div><a href="https://matplotlib.org/examples/event_handling/viewlims.html" target="_blank">https://matplotlib.org/<wbr />examples/event_handling/<wbr />viewlims.html</a> <br /></div>
<div><br /></div>
<div>for an example.</div>
<div><br /></div>
<div>This is probably the best route to go down as you can do other interesting things as the event goes by (like triggering computation, updating a openGL view window, etc) as well as updating the Matplotlib limits.</div>
<div><br /></div>
<div>Tom</div>
</div>
<br />
<div class="gmail_quote">
<div dir="ltr">On Mon, May 15, 2017 at 3:29 AM Juan Nunez-Iglesias <<a href="mailto:jni.soma@gmail.com" target="_blank">jni.soma@gmail.com</a>> wrote:<br /></div>
<blockquote class="gmail_quote" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #34495e;">
<div>
<div name="messageBodySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif">Hello,
<div><br /></div>
<div>I’m trying to build an orthogonal-views volume viewer in Matplotlib like this one:</div>
<div><a href="https://imagej.nih.gov/ij/docs/guide/images/OrthogonalViews.png" target="_blank">https://imagej.nih.gov/ij/<wbr />docs/guide/images/<wbr />OrthogonalViews.png</a><br /></div>
<div><br /></div>
<div>For this to work, I need to share the y-axis of the YZ (right) view/subplot with the x-axis of the XZ (bottom) view/subplot. Is this possible?</div>
<div><br /></div>
<div>Juan.</div>
</div>
<div name="messageReplySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif"><br /></div>
</div>
______________________________<wbr />_________________<br />
Matplotlib-users mailing list<br />
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br />
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/<wbr />mailman/listinfo/matplotlib-<wbr />users</a><br /></blockquote>
</div>
</blockquote>
</div>
</div>
</div>
</div>
<br />
______________________________<wbr />_________________<br />
Matplotlib-users mailing list<br />
<a href="mailto:Matplotlib-users@python.org">Matplotlib-users@python.org</a><br />
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/<wbr />mailman/listinfo/matplotlib-<wbr />users</a><br />
<br /></blockquote>
</div>
<br /></div>
</blockquote>
</div>
</blockquote>
<div></div>
</div>
</body>
</html>