Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-17 Thread Darren Dale
On Tue, Feb 16, 2010 at 9:53 PM, John Hunter jdh2...@gmail.com wrote:
 On Tue, Feb 16, 2010 at 3:57 PM, Ernest Adrogué eadro...@gmx.net wrote:
 16/02/10 @ 16:20 (-0500), thus spake Filipe Pires Alvarenga Fernandes:
 \\  works for titles and label, but not for DateFormatter, but \vspace did
 the trick!

 Thanks again for the help.

 ps: I'm new to python, but maybe there is a way to mix Latex and unicode?

 Yes, the inputenc package from latex lets you use unicode.
 Try adding this to your script:
 plt.rc('text.latex', preamble='\usepackage[utf]{inputenc}')

 Note that this setting is not officially supported, whatever
 that means :)

 I think it means that Darren, who did most of the heavy lifting for
 these features, was getting tired of the endless line of additional
 things TeX users wanted to do and the difficulties supporting these
 across all platforms (eg MikTex on Windows) and drew a line in the
 sand saying I'll add this stuff but if you report problems I may not
 stay up all night trying to fix them.

That is a fair explanation. Adding arbitrary lines to the latex
preamble adds an incredible amount of flexibility if you are a user,
and it provides plenty of rope with which to hang yourself if you are
a developer (answering questions/problems related to people writing
bad python code, misconfigured latex installations, and bad latex
code!). At the time, we had finally shaped the latex backend into
something that worked across platforms (and different versions of
latex installations), plus I was also finishing up grad school and
starting a new job, so I had reservations about even adding this
feature to the library. But people really wanted it so we compromised.

Darren

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-17 Thread PHobson
 On Tue, Feb 16, 2010 at 9:53 PM, John Hunter jdh2...@gmail.com wrote:
  I think it means that Darren, who did most of the heavy lifting for
  these features, was getting tired of the endless line of additional
  things TeX users wanted to do and the difficulties supporting these
  across all platforms (eg MikTex on Windows) and drew a line in the
  sand saying I'll add this stuff but if you report problems I may not
  stay up all night trying to fix them.


 From: Darren Dale [mailto:dsdal...@gmail.com]
 Sent: Wednesday, February 17, 2010 4:55 AM
 That is a fair explanation. Adding arbitrary lines to the latex
 preamble adds an incredible amount of flexibility if you are a user,
 and it provides plenty of rope with which to hang yourself if you are
 a developer (answering questions/problems related to people writing
 bad python code, misconfigured latex installations, and bad latex
 code!). At the time, we had finally shaped the latex backend into
 something that worked across platforms (and different versions of
 latex installations), plus I was also finishing up grad school and
 starting a new job, so I had reservations about even adding this
 feature to the library. But people really wanted it so we compromised.

Compromised or not, it's a great feature and I'm *really* happy it made it was 
included! Thanks for all of the effort.

-Paul H.
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread Ernest Adrogué
15/02/10 @ 19:22 (-0500), thus spake Filipe Pires Alvarenga Fernandes:
 Hello list,
 
 If I use DateFormatter with latex and lines breaks like this
  DateFormatter(\n \n %b) I get an latex error:
 
 http://pastebin.com/m5b186ded
 
 Although, if I do not use the line breaks,
  DateFormatter(%b)
 The problem disappears.
 
 Below is a script that reproduces what I'm talking about:
 
 #Example:
 from pylabimport *
 from matplotlib   import rcParams
 rcParams['text.usetex'] = True
 fig = figure()
 ax  = fig.add_subplot(111)
 fig.subplots_adjust(bottom=0.2)
 t = arange(100,110,.1)
 u = sin(t)
 v = cos(t)
 quiver([t],[[0]*len(t)],u,v)
 major  = DayLocator([10,04])
 minor  = DayLocator()
 majorF = DateFormatter(\n \n %b) # problem
 ^^  ^^
A common mistake.
You forgot to escape the \ characters.

Bye.

Ernest

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread Filipe Pires Alvarenga Fernandes
 Thanks Ernest, I had no idea that the DateFormatter was going to be treated
as latex as well.

However, escaping the \ with another \ did not worked.
I tried:

majorF = DateFormatter(\\n \\n %b)

How should I escape the \n ?


 majorF = DateFormatter(\n \n %b) # problem
  ^^  ^^
 A common mistake.
 You forgot to escape the \ characters.

 Bye.

 Ernest

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread Ernest Adrogué
16/02/10 @ 09:03 (-0500), thus spake Filipe Pires Alvarenga Fernandes:
  Thanks Ernest, I had no idea that the DateFormatter was going to be treated
 as latex as well.

Yes, all strings are processed by LaTeX.

 
 However, escaping the \ with another \ did not worked.
 I tried:
 
 majorF = DateFormatter(\\n \\n %b)
 
 How should I escape the \n ?

In theory, \\n \\n %b or r\n \n %b, however only the former
seems to work in my computer.

There's another problem: \n is not a valid LaTeX command.
I tried with \\ and with \newline but neither appear to work. 
\vspace{10pts} does insert whitespace, however I am not sure if
it's the proper way of doing it...

Bye.

 
  majorF = DateFormatter(\n \n %b) # problem
   ^^  ^^
  A common mistake.
  You forgot to escape the \ characters.
 
  Bye.
 
  Ernest
 

 --
 SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
 Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
 http://p.sf.net/sfu/solaris-dev2dev

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread Filipe Pires Alvarenga Fernandes
\\  works for titles and label, but not for DateFormatter, but \vspace did
the trick!

Thanks again for the help.

ps: I'm new to python, but maybe there is a way to mix Latex and unicode?


 as latex as well.

 Yes, all strings are processed by LaTeX.

 
  However, escaping the \ with another \ did not worked.
  I tried:
 
  majorF = DateFormatter(\\n \\n %b)
 
  How should I escape the \n ?

 In theory, \\n \\n %b or r\n \n %b, however only the former
 seems to work in my computer.

 There's another problem: \n is not a valid LaTeX command.
 I tried with \\ and with \newline but neither appear to work.
 \vspace{10pts} does insert whitespace, however I am not sure if
 it's the proper way of doing it...

 Bye.

 
   majorF = DateFormatter(\n \n %b) # problem
^^  ^^
   A common mistake.
   You forgot to escape the \ characters.
  
   Bye.
  
   Ernest

  Thanks Ernest, I had no idea that the DateFormatter was going to be
treated
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread Ernest Adrogué
16/02/10 @ 16:20 (-0500), thus spake Filipe Pires Alvarenga Fernandes:
 \\  works for titles and label, but not for DateFormatter, but \vspace did
 the trick!
 
 Thanks again for the help.
 
 ps: I'm new to python, but maybe there is a way to mix Latex and unicode?

Yes, the inputenc package from latex lets you use unicode.
Try adding this to your script:
plt.rc('text.latex', preamble='\usepackage[utf]{inputenc}')

Note that this setting is not officially supported, whatever
that means :)

I also like the txfonts package:
\usepackage[varg]{txfonts}

which changes the default font to Times, including the text in
mathematical expressions. It looks great.

Cheers.

Ernest

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread Jae-Joon Lee
On Tue, Feb 16, 2010 at 4:05 PM, Ernest Adrogué eadro...@gmx.net wrote:
 \vspace{10pts} does insert whitespace, however I am not sure if
 it's the proper way of doing it...


Can you (or someone else) confirm this? I don't think pts is a
proper tex unit and it should be \vspace{10pt}. Maybe this is a typo
in the email. I'm asking this because it does not work for me, and I
don't think it is supposed to work (but I may be wrong).

Regards,

-JJ

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread PHobson
 -Original Message-
 From: Ernest Adrogué [mailto:eadro...@gmx.net]
 Sent: Tuesday, February 16, 2010 1:58 PM
 To: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] DateFormatter + Latex issue
 
 16/02/10 @ 16:20 (-0500), thus spake Filipe Pires Alvarenga Fernandes:
  \\  works for titles and label, but not for DateFormatter, but
 \vspace did
  the trick!
 
  Thanks again for the help.
 
  ps: I'm new to python, but maybe there is a way to mix Latex and
 unicode?
 
 Yes, the inputenc package from latex lets you use unicode.
 Try adding this to your script:
 plt.rc('text.latex', preamble='\usepackage[utf]{inputenc}')
 
 Note that this setting is not officially supported, whatever
 that means :)
 
 I also like the txfonts package:
 \usepackage[varg]{txfonts}
 
 which changes the default font to Times, including the text in
 mathematical expressions. It looks great.

Good tip. I also like \usapackage{fourier} to get the utopia fonts, which are 
particularly useful since I'm always plotting concentrations and having a 
upright mu ($\othermu$) is really nice.

-paul h.

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread Jae-Joon Lee
If what you want is to have more padding for the major tick labels, I
recommend you to use

rcParams['xtick.major.pad'] = 20

If you don't like to change the global setting, you may set the
ticklabel padding for an specific axis. Try

for tck in ax.xaxis.get_major_ticks():
tck.set_pad(20)
tck.label1 = tck._get_text1()

Regards,

-JJ


On Tue, Feb 16, 2010 at 4:20 PM, Filipe Pires Alvarenga Fernandes
ocef...@gmail.com wrote:
 \\  works for titles and label, but not for DateFormatter, but \vspace did
 the trick!

 Thanks again for the help.

 ps: I'm new to python, but maybe there is a way to mix Latex and unicode?


  as latex as well.

 Yes, all strings are processed by LaTeX.

 
  However, escaping the \ with another \ did not worked.
  I tried:
 
  majorF = DateFormatter(\\n \\n %b)
 
  How should I escape the \n ?

 In theory, \\n \\n %b or r\n \n %b, however only the former
 seems to work in my computer.

 There's another problem: \n is not a valid LaTeX command.
 I tried with \\ and with \newline but neither appear to work.
 \vspace{10pts} does insert whitespace, however I am not sure if
 it's the proper way of doing it...

 Bye.

 
   majorF = DateFormatter(\n \n %b) # problem
                            ^^  ^^
   A common mistake.
   You forgot to escape the \ characters.
  
   Bye.
  
   Ernest

  Thanks Ernest, I had no idea that the DateFormatter was going to be
 treated

 --
 SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
 Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
 http://p.sf.net/sfu/solaris-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread Ernest Adrogué
Hi,

16/02/10 @ 17:01 (-0500), thus spake Jae-Joon Lee:
 On Tue, Feb 16, 2010 at 4:05 PM, Ernest Adrogué eadro...@gmx.net wrote:
  \vspace{10pts} does insert whitespace, however I am not sure if
  it's the proper way of doing it...
 
 
 Can you (or someone else) confirm this? I don't think pts is a
 proper tex unit and it should be \vspace{10pt}. Maybe this is a typo
 in the email. I'm asking this because it does not work for me, and I
 don't think it is supposed to work (but I may be wrong).

You're right!
\vspace{10pts} adds space (seems about 10 points) but it also
prints a s before the space, which I didn't see before.
Now, \vspace{10pt} doesn't work for me... it simply does nothing.

Bye.

 Regards,
 
 -JJ

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread Filipe Pires Alvarenga Fernandes
JJ:
Wonderful, simple  and much less messy and Latex+unicode. Although, now I'm
fascinated by the Latex possibilities!

Ernest:
 I haven't notice the s before when using pts, but what is really
strange is that pt does not work!


Thank you all again, Filipe
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread Jae-Joon Lee
On Tue, Feb 16, 2010 at 5:25 PM, Filipe Pires Alvarenga Fernandes
ocef...@gmail.com wrote:
  I haven't notice the s before when using pts, but what is really
 strange is that pt does not work!


As I said, it is not supposed to work, because of some technical
reason. When there is a single line of text, it is hardly possible to
get to know the original baseline of the text.

By the way, the original problem that \n\n %b didn't work seems like
a actual bug (it is supposed to work without escaping '\n'). This
should now be fixed in the svn (r8135 in maint. branch and r8136 in
HEAD) . Still, it is recommended to adjust the pad of the ticklabels
instead of fiddling with newlines and etc.

Regards,

-JJ

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-16 Thread John Hunter
On Tue, Feb 16, 2010 at 3:57 PM, Ernest Adrogué eadro...@gmx.net wrote:
 16/02/10 @ 16:20 (-0500), thus spake Filipe Pires Alvarenga Fernandes:
 \\  works for titles and label, but not for DateFormatter, but \vspace did
 the trick!

 Thanks again for the help.

 ps: I'm new to python, but maybe there is a way to mix Latex and unicode?

 Yes, the inputenc package from latex lets you use unicode.
 Try adding this to your script:
 plt.rc('text.latex', preamble='\usepackage[utf]{inputenc}')

 Note that this setting is not officially supported, whatever
 that means :)

I think it means that Darren, who did most of the heavy lifting for
these features, was getting tired of the endless line of additional
things TeX users wanted to do and the difficulties supporting these
across all platforms (eg MikTex on Windows) and drew a line in the
sand saying I'll add this stuff but if you report problems I may not
stay up all night trying to fix them.

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] DateFormatter + Latex issue

2010-02-15 Thread Filipe Pires Alvarenga Fernandes
Hello list,

If I use DateFormatter with latex and lines breaks like this
 DateFormatter(\n \n %b) I get an latex error:

http://pastebin.com/m5b186ded

Although, if I do not use the line breaks,
 DateFormatter(%b)
The problem disappears.

Below is a script that reproduces what I'm talking about:

#Example:
from pylabimport *
from matplotlib   import rcParams
rcParams['text.usetex'] = True
fig = figure()
ax  = fig.add_subplot(111)
fig.subplots_adjust(bottom=0.2)
t = arange(100,110,.1)
u = sin(t)
v = cos(t)
quiver([t],[[0]*len(t)],u,v)
major  = DayLocator([10,04])
minor  = DayLocator()
majorF = DateFormatter(\n \n %b) # problem
#majorF = DateFormatter(%b) # no problem
minorF = DateFormatter('%d')
ax.xaxis.set_major_locator(major)
ax.xaxis.set_minor_locator(minor)
ax.xaxis.set_major_formatter(majorF)
ax.xaxis.set_minor_formatter(minorF)
gca().xaxis_date()
title(r$\alpha \beta \gamma \delta$)
show()


I'm using the latest svn version with qt4 as backend.

Thanks, Filipe
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users