[Matplotlib-devel] Help for testing unicode support on the MacOS backend
Chris Barker
chris.barker at noaa.gov
Tue Jan 5 15:49:28 EST 2016
On Tue, Jan 5, 2016 at 6:42 AM, Jens Nielsen <jenshnielsen at gmail.com> wrote:
> Great, Sounds like that is every backend then
>
Anyone try wxPython? It should be fine, but worth a check.
-CHB
>
> Jens
>
> On Tue, 5 Jan 2016 at 14:26 Antony Lee <antony.lee at berkeley.edu> wrote:
>
>> Works with PySide Py2/Py3 (on Linux).
>>
>> 2016-01-05 6:11 GMT-08:00 Jens Nielsen <jenshnielsen at gmail.com>:
>>
>>> 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
>>>>
>>>
>>
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-devel
>
>
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20160105/ce3180fd/attachment.html>
More information about the Matplotlib-devel
mailing list