Re: [Matplotlib-users] Unicode characters in PS output
On Mon, Feb 25, 2013 at 11:00 PM, Ryan Nelson rnelsonc...@gmail.com wrote: On 2/25/2013 9:29 PM, Gökhan Sever wrote: Hello, For some reason, I can't get the degree sign showing up in my ps output: Here is the simple test code: fp = plt.figure(figsize=(8.5, 11)) fp.text(0.5, 0.5, uTemperature, ⁰C, color='black', fontsize=16) plt.savefig('test.ps', papertype='letter') plt.savefig('test.pdf', papertype='letter') PS output shows Temperature, ?C, however PDF renders degree sign correctly. I can't seem to select the text in PS output, but the text is selectable in PDF. This is probably a font issue, where PDF uses DejaVu, on the other hand PS uses a Times type font. So, how can I adjust matplotlib to save in PS file? Thanks. -- Gökhan Gökhan, I tried your code, and everything worked fine for me. (PythonXY 2.7.3.1 on Windows 7) However, I usually use the escaped unicode value rather than unicode characters directly. Does the following work instead: fp = plt.figure(figsize=(8.5, 11)) fp.text(0.5, 0.5, uTemperature, \u00B0C, color='black', fontsize=16) plt.savefig('test.ps', papertype='letter') plt.savefig('test.pdf', papertype='letter') Just a thought. Hope it helps. Ryan This works fine. However it is easy to remember a superscript o then its code :) By the way, can you select the text within the PS file? -- Gökhan -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] axvspan legend
Hi, I have a time series data which I am using plot_time(). I am able to get a legend and I also have axvspan to show weekends. However, how can I state the yellow (axvspan) is a weekend on the legend or is there a better way to show this? -- --- Get your facts first, then you can distort them as you please.-- -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Unicode characters in PS output
Hi, Le 26/02/2013 12:38, Gökhan Sever a écrit : fp = plt.figure(figsize=(8.5, 11)) fp.text(0.5, 0.5, uTemperature, \u00B0C, color='black', fontsize=16) plt.savefig('test.ps http://test.ps', papertype='letter') plt.savefig('test.pdf', papertype='letter') Just a thought. Hope it helps. Ryan This works fine. However it is easy to remember a superscript o then its code :) By the way, can you select the text within the PS file? I just noticed that you are using here the character U+2070 superscript zero (^(0)) while Ryan's proposition is U+00B0 degree sign (°) which I think is the correct one to use. This being said, there should be no difference between using the Unicode code and actual ° character (and I agree it's simpler to remember) In [1]: a = uTemperature, \u00B0C In [2]: a Out[2]: u'Temperature, \xb0C' In [6]: b = uTemperature °C In [7]: b Out[7]: u'Temperature \xb0C' Coming back to your other question, I can't select the text in the PS file (using Okular or Evince). (but PDF is selectable) Also, the PS file renders properly with both ^(0) and ° signs. (but with PDF, the ^(0) is placed to low, while ° is fine) Best, Pierre signature.asc Description: OpenPGP digital signature -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Unicode characters in PS output
On Tue, Feb 26, 2013 at 6:02 AM, Pierre Haessig pierre.haes...@crans.orgwrote: Hi, Le 26/02/2013 12:38, Gökhan Sever a écrit : fp = plt.figure(figsize=(8.5, 11)) fp.text(0.5, 0.5, uTemperature, \u00B0C, color='black', fontsize=16) plt.savefig('test.ps', papertype='letter') plt.savefig('test.pdf', papertype='letter') Just a thought. Hope it helps. Ryan This works fine. However it is easy to remember a superscript o then its code :) By the way, can you select the text within the PS file? I just noticed that you are using here the character U+2070 superscript zero (⁰) while Ryan's proposition is U+00B0 degree sign (°) which I think is the correct one to use. This being said, there should be no difference between using the Unicode code and actual ° character (and I agree it's simpler to remember) You are right, U+00B0 is the right one. I think, I couldn't find a superscript o easily then decided to use superscript zero from http://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts However, there is a slight difference in their appearance when I compare them side by side. For simplicity, I just use subscript and superscript unicode symbols to construct simple units. In [1]: a = uTemperature, \u00B0C In [2]: a Out[2]: u'Temperature, \xb0C' In [6]: b = uTemperature °C In [7]: b Out[7]: u'Temperature \xb0C' Coming back to your other question, I can't select the text in the PS file (using Okular or Evince). (but PDF is selectable) Also, the PS file renders properly with both ⁰ and ° signs. (but with PDF, the ⁰ is placed to low, while ° is fine) Could you test my outputs if they look fine on your side? http://atmos.uwyo.edu/~gsever/data/matplotlib/test.pdf http://atmos.uwyo.edu/~gsever/data/matplotlib/test.ps Thanks. Best, Pierre -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Gökhan -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] axvspan legend
On Tue, Feb 26, 2013 at 7:44 AM, Rita rmorgan...@gmail.com wrote: Hi, I have a time series data which I am using plot_time(). I am able to get a legend and I also have axvspan to show weekends. However, how can I state the yellow (axvspan) is a weekend on the legend or is there a better way to show this? I believe you are looking for Proxy Artists: http://matplotlib.org/users/legend_guide.html#using-proxy-artist Cheers! Ben Root -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Unicode characters in PS output
Le 26/02/2013 14:38, Gökhan Sever a écrit : Could you test my outputs if they look fine on your side? http://atmos.uwyo.edu/~gsever/data/matplotlib/test.pdf http://atmos.uwyo.edu/%7Egsever/data/matplotlib/test.pdf http://atmos.uwyo.edu/~gsever/data/matplotlib/test.ps http://atmos.uwyo.edu/%7Egsever/data/matplotlib/test.ps Good idea ! * your PDF file looks fine with Okular * your PS indeed has the problem you describe (again Okular) : - ° (degree sign) is fine - but ⁰ (zero superscript) is replaced by ? In case it may explain the difference : I'm using mpl 1.1.1rc2 from Debian testing and I have the following line in my matplotlibrc (is it relevant ???) font.sans-serif : DejaVu Sans, sans-serif Best, Pierre signature.asc Description: OpenPGP digital signature -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Unicode characters in PS output
On Tue, Feb 26, 2013 at 8:29 AM, Pierre Haessig pierre.haes...@crans.orgwrote: Le 26/02/2013 14:38, Gökhan Sever a écrit : Could you test my outputs if they look fine on your side? http://atmos.uwyo.edu/~gsever/data/matplotlib/test.pdf http://atmos.uwyo.edu/~gsever/data/matplotlib/test.ps Good idea ! * your PDF file looks fine with Okular * your PS indeed has the problem you describe (again Okular) : - ° (degree sign) is fine - but ⁰ (zero superscript) is replaced by ? In case it may explain the difference : I'm using mpl 1.1.1rc2 from Debian testing and I have the following line in my matplotlibrc (is it relevant ???) font.sans-serif : DejaVu Sans, sans-serif Best, Pierre My matplotlib is a git clone of a couple weeks old. There is this line in the PS file (opening via vim) %%BeginResource: font KDYSTE+NewCenturySchlbk-Roman don't know where it gets this. #font.serif : DejaVu Serif, Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif font.sans-serif : DejaVu Sans, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif PS uses that even I choose to use fot.sans-serif. Dont see any font specification in the PDF file. -- Gökhan -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users