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

Jens Nielsen jenshnielsen at gmail.com
Tue Jan 5 09:11:08 EST 2016


We should be careful about the PySide QT4 backend and unicode. See
https://github.com/matplotlib/matplotlib/pull/5690

best
Jens

On Tue, 5 Jan 2016 at 14:06 Michael Droettboom <mdroettboom at continuum.io>
wrote:

> 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.
>
> Mike
>
> 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
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20160105/ae07c9bf/attachment-0001.html>


More information about the Matplotlib-devel mailing list