<div dir="ltr">Perhaps it might make sense to generalize this stuff even further with some sort of format string approach with named components. So, people could modify the format string without needing to do a massive code modification?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 23, 2018 at 7:50 PM, Benjamin Root <span dir="ltr"><<a href="mailto:ben.v.root@gmail.com" target="_blank">ben.v.root@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I think this is reasonable. Can you make a Pull Request with this change?<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 23, 2018 at 5:28 PM, Olivier via Matplotlib-users <span dir="ltr"><<a href="mailto:matplotlib-users@python.org" target="_blank">matplotlib-users@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
Please consider the figure produced by "im = imshow(scipy.misc.face())". The message in the Toolbar reflects the position of the cursor and displays for example:<br>
<br>
"x=843.9 y=384.7 [91, 102, 88]"<br>
<br>
I changed the method "im.axes.format_coord()" in order to show specific information in the Toolbar message, and this works fine.<br>
<br>
However, the value of the cursor data, i.e. the string " [91, 102, 88]" in the example above, is still printed after my home-made coordinate information.<br>
<br>
PROBLEM: I don't want this information to be displayed.<br>
<br>
NOT A SOLUTION: I overrode the method "im.format_cursor_data()" so that it returns either "" or 'None'. However, in both cases, the brackets are still displayed, showing either " []" or " [None]", which I find unsatisfactory.<br>
<br>
It seems that the brackets are hardcoded in "backend_bases.NavigationToolb<wbr>ar2.mouse_move()".<br>
<br>
Is there a clean way to get rid of the cursor data and the brackets?<br>
<br>
If not, I suggest the patch below. Does it make sense? The effect is simply that if "im.format_cursor_data()" returns 'None', no cursor data will be appended to the coordinate information.<br>
<br>
Best regards,<br>
<br>
Olivier<br>
<br>
"""<br>
--- backend_bases.py 2017-12-10 04:59:43.000000000 +0100<br>
+++ temp/backend_bases.py 2018-03-23 22:09:10.611351451 +0100<br>
@@ -2898,7 +2898,9 @@<br>
if a is not event.inaxes.patch:<br>
data = a.get_cursor_data(event)<br>
if data is not None:<br>
- s += ' [%s]' % a.format_cursor_data(data)<br>
+ data_str = a.format_cursor_data(data)<br>
+ if data_str is not None:<br>
+ s += ' [%s]' % data_str<br>
<br>
if len(self.mode):<br>
self.set_message('%s, %s' % (self.mode, s))<br>
"""<br>
<br>
______________________________<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/mailma<wbr>n/listinfo/matplotlib-users</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>