[Matplotlib-devel] Help for testing unicode support on the MacOS backend

Michael Droettboom mdroettboom at continuum.io
Tue Jan 5 09:06:40 EST 2016

The Mac OSX backend seems to work just fine.

That docstring comment goes back to 2008, and the OSS GUI frameworks and
Python 3 etc. have made great strides with Unicode support since then.  We
should probably just remove it along with your proposed change.


On Mon, Jan 4, 2016 at 6:48 PM, Antony Lee <antony.lee at berkeley.edu> wrote:

> Hi all,
> As part of my rewrite of the Formatter classes (#5787), I am planning to
> switch to always use `fix_minus` in the statusbar text (i.e., use a
> typographically correct unicode "MINUS SIGN" rather than a dash for
> negative numbers).
> The original docstring on the topic was
>     Some classes may want to replace a hyphen for minus with the
>     proper unicode symbol (U+2212) for typographical correctness.
>     The default is to not replace it.
>     Note, if you use this method, e.g., in :meth:`format_data` or
>     call, you probably don't want to use it for
>     :meth:`format_data_short` since the toolbar uses this for
>     interactive coord reporting and I doubt we can expect GUIs
>     across platforms will handle the unicode correctly.  So for
>     now the classes that override :meth:`fix_minus` should have an
>     explicit :meth:`format_data_short` method
> I have tried the Tk, Qt4, Qt5 (Python2/3), Gtk (Python2) and Gtk3
> (Python3) backends on Linux, as well as Tk and Qt4 (Python2) on Windows and
> they all handle unicode fine.  Can someone try the MacOS backend for me?
> You basically need to patch ScalarFormatter.format_data_short (in
> ticker.py) to wrap the returned values in `self.fix_minus`
>     def format_data_short(self, value):
>         """return a short formatted string representation of a number"""
>         if self._useLocale:
>             return self.fix_minus(locale.format_string('%-12g', (value,)))
>         else:
>             return self.fix_minus('%-12g' % value)
> plot e.g. `plot([-1, 1])`, and check that the statusbar displays negative
> x values properly (with a minus sign that's actually much more readable
> IMO).
> Thanks,
> Antony
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-devel

Michael Droettboom
Continuum Analytics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20160105/465049ab/attachment.html>

More information about the Matplotlib-devel mailing list