Re: [Matplotlib-users] Unicode characters in PS output

2013-02-28 Thread Pierre Haessig
Hi Thomas,

Le 27/02/2013 20:59, Thomas Sprinzing a écrit :
 To sum it up: use the old 7-bit equivalent for the degree sign, not any 
 fancydancy UTF-8 character that is commonly not included in ye olde style 
 postscript standard font embedded into your laser printer wy back then in 
 the last millenium... 
Just out of curiosity, I looked at the list of ASCII printable
characters
(http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters) and
didn't find the degree sign. However, I found it in the so-called 8
bits extensions, which I believe is just the same as the Unicode U+00B0
character.

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

2013-02-28 Thread Gökhan Sever
Okay, fair enough.

But do you have any ideas, how to force the PS creator to use a different
font?

Say - font Times-Bold


On Wed, Feb 27, 2013 at 12:59 PM, Thomas Sprinzing 
sprinz...@hdm-stuttgart.de wrote:

 I'd say it's got nearly nothing to do with matplotlib.

 The question is: will the font be included in the .ps and in the .pdf?

 If not, which is most likely, it's upon the renderer to decide what to do
 if the requested glyph in the requested font is present or not in the
 system.

 pdf is more likely to have the fonts / glyphs used also embeded in the
 pdf. One reason for them to be bigger than .ps. Ps, on the other hand, most
 of the times relys on the renderer to have the exact same font, referenced
 by name, pre-loaded in the system. Go figure.

 To sum it up: use the old 7-bit equivalent for the degree sign, not any
 fancydancy UTF-8 character that is commonly not included in ye olde style
 postscript standard font embedded into your laser printer wy back then
 in the last millenium...

 Am 26.02.2013 um 21:26 schrieb Gökhan Sever:

 
 
  On Tue, Feb 26, 2013 at 8:29 AM, Pierre Haessig 
 pierre.haes...@crans.org wrote:
  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



 --
 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] Unicode characters in PS output

2013-02-28 Thread Thomas Sprinzing

Am 28.02.2013 um 14:31 schrieb Pierre Haessig:

 Hi Thomas,
 
 Le 27/02/2013 20:59, Thomas Sprinzing a écrit :
 To sum it up: use the old 7-bit equivalent for the degree sign, not any 
 fancydancy UTF-8 character that is commonly not included in ye olde style 
 postscript standard font embedded into your laser printer wy back then 
 in the last millenium... 
 Just out of curiosity, I looked at the list of ASCII printable
 characters
 (http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters) and
 didn't find the degree sign. However, I found it in the so-called 8
 bits extensions, which I believe is just the same as the Unicode U+00B0

confirmed by looking at
http://www.adobe.com/type/browser/info/charsets.html

Adobe western 2 has the same info.

Alt-0179 or U+00B0

So, best is to use the degree sign.

If you're not sure, what's present at rendering time, maybe try to force the 
generator to convert fonts to ps paths. 
But i donÄt know if matplotlib has tat optin at all...
--
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

2013-02-27 Thread Thomas Sprinzing
I'd say it's got nearly nothing to do with matplotlib.

The question is: will the font be included in the .ps and in the .pdf?

If not, which is most likely, it's upon the renderer to decide what to do if 
the requested glyph in the requested font is present or not in the system.

pdf is more likely to have the fonts / glyphs used also embeded in the pdf. One 
reason for them to be bigger than .ps. Ps, on the other hand, most of the times 
relys on the renderer to have the exact same font, referenced by name, 
pre-loaded in the system. Go figure.

To sum it up: use the old 7-bit equivalent for the degree sign, not any 
fancydancy UTF-8 character that is commonly not included in ye olde style 
postscript standard font embedded into your laser printer wy back then in 
the last millenium... 

Am 26.02.2013 um 21:26 schrieb Gökhan Sever:

 
 
 On Tue, Feb 26, 2013 at 8:29 AM, Pierre Haessig pierre.haes...@crans.org 
 wrote:
 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


--
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

2013-02-26 Thread Gökhan Sever
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


Re: [Matplotlib-users] Unicode characters in PS output

2013-02-26 Thread Pierre Haessig
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

2013-02-26 Thread Gökhan Sever
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] Unicode characters in PS output

2013-02-26 Thread Pierre Haessig
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

2013-02-26 Thread Gökhan Sever
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


[Matplotlib-users] Unicode characters in PS output

2013-02-25 Thread Gökhan Sever
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
--
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

2013-02-25 Thread Ryan Nelson

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, ^(0)C, color='black', fontsize=16)
plt.savefig('test.ps http://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


--
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,

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 http://test.ps', papertype='letter')
plt.savefig('test.pdf', papertype='letter')

Just a thought. Hope it helps.

Ryan


--
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