Re: [Matplotlib-users] PY2EXE with Matplotlib and wxPython compiles but won't run???

2010-05-20 Thread Werner F. Bruhin
On 19/05/2010 20:45, David wrote:
 Werner F. Bruhinwerner.bru...@...  writes:



 On 19/05/2010 19:55, David Grudoski wrote:

I'm trying to build an executable using
 PY2EXE; running Python 2.5.2 and wxPython 2.8.10.1 and MatplotLib 0.99.0
I tried using the setup.py from the
 PY2EXE.org Matplotlib page and although everything compiles correctly
 and generates an executable.
When I launch the executable I get the
 following error:

The application requires a version of
 wxPython greater than or equal to 2.8, but a matching version was not
 found.
You currently have these version(s)
 installed.




I can compile an executable with PY2EXE and
 wxPython that works fine, but apparantly somethins in the setup for
 matplotlib is causing a problem.

Has anyone else seen this problem or know of
 a solution?

 You need to patch matplotlib (backend_wx.py), see the bottom of this
 page:http://www.py2exe.org/index.cgi/MatPlotLib
 Werner


 --



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

  
 Thanks for the reply Werner,
 I decided to try and construct the executable from the site using the
 embedding_in_wx2.py example. Again making sure the patch was in place on the
 backend_wx.py I again ran the python setup.py py2exe and everything compiled.
 Now when I run the exe it generate the following log file errors:
 Traceback (most recent call last):
File embedding_in_wx2.py, line 21, inmodule
File zipextimporter.pyo, line 82, in load_module
File matplotlib\backends\backend_wxagg.pyo, line 20, inmodule
File zipextimporter.pyo, line 82, in load_module
File matplotlib\figure.pyo, line 19, inmodule
File zipextimporter.pyo, line 82, in load_module
File matplotlib\axes.pyo, line 14, inmodule
File zipextimporter.pyo, line 82, in load_module
File matplotlib\collections.pyo, line 21, inmodule
File zipextimporter.pyo, line 82, in load_module
File matplotlib\backend_bases.pyo, line 32, inmodule
File zipextimporter.pyo, line 82, in load_module
File matplotlib\widgets.pyo, line 12, inmodule
File zipextimporter.pyo, line 82, in load_module
File matplotlib\mlab.pyo, line 376, inmodule
 TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'

This is due to using optimize 1 or 2 in py2exe, the work around is to 
fix four lines in mpl.mlab.py as shown on the wiki page mentioned in the 
last thread.

Werner


--

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


Re: [Matplotlib-users] hist question...

2010-05-20 Thread Alan G Isaac
On 5/18/2010 9:53 AM, Nick Schurch wrote:
 Is there anyway of re-ploting the distribution generated by hist at a
 later point?

http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html

hth,
Alan Isaac


--

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


Re: [Matplotlib-users] linearized log axis

2010-05-20 Thread Christer
Thank you for the help, I never knew what the symlog flag did actually.

However, there is still a slight problem:

=
x = array([0,1,2,4,6,9,12,24])
y = array([100, 50, 10, 100, 5, 1, 1, 1])
subplot(111)
plot(x, y)
yscale('symlog')
xscale=('linear')
ylim(-1,1000)
show()
=

The plot looks exactly like I want it, the problem is when I change  
the 1's to 0's in the y-array, then I get a:

File C:\Python26\lib\site-packages\matplotlib\ticker.py, line 1029,  
in is_decade
 lx = math.log(x)/math.log(base)
ValueError: math domain error

I suppose that means somewhere a log(0) is attempted. This kind of  
defeats the purpose...

/C

Quoting Eric Firing efir...@hawaii.edu:

 On 05/19/2010 10:28 AM, Benjamin Root wrote:
 Maybe I am misunderstanding your problem, but you can select
'semilog'
 for the x/yscale parameter.

 You mean symlog.

 See

http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html

 Although the example doesn't show it, the axis limits don't have to be
 symmetric.  For example, on the top plot, you can use

 gca().set_xlim([0, 100])

 to show only the right-hand side.

 Eric



 Ben Root

 On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg
 christer.malmberg.0...@student.uu.se
 mailto:christer.malmberg.0...@student.uu.se wrote:

 Hi,

 my problem is that I need a graph with a discontinous y-axis. Let
me
 explain the problem: in my field (microbiology) the data
generated
 from for example growth assays have a huge range (10^0-10^9),
which
 has to be plotted on a semilogy style plot (cell concentration
vs.
 time). The problem is that 0 cells is a useful number to plot
 (indicates cell concentration lower than detection limit), but of
 course not possible to show in a log diagram. This is easily
solved on
 old-style logarithmic graph paper; since the data will be either
0, or
  1 it is customary just to draw a zero x-axis at 10^-1 on the
paper
 and that's that. On the computer, this is extremely hard. Most
people
 I know resort to various tricks in Excel, such as entering a
small
 number (0.001 etc) and starting the y-axis range from 10^1 to
hide the
 problem. This makes excel draw a line, instead of leaving out the
dot
 and line entirely. The part of the curve below the x-axis is then
 manually cut off in a suitable image editor. Needless to say,
this is
 extremely kludgy. Even professional graphing packages like
Graphpad
 Prism resort to similar kludges (re-define 0 values to 0.1,
change the
 y-axis tick label to 0 etc.) This problem of course exists in
other
 fields, while investigating a solution I found a guy who worked
with
 aerosol contamination in clean rooms, and he needed to plot
values
 logarithmically, at the same time as showing detector noise
around
 1-10 particles. He solved it by the same trick I would like to do
in
 Matplotlib, namely plotting a standard semilogy plot but with the
 10^-1 to 10^0 decade being replaced by a 0-1 linear axis on the
same
 side.

 The guy in this post has the same problem and a useful example:
 http://ubuntuforums.org/showthread.php?t=394851

 His partial solution is quite bad though, and I just got stuck
while
 trying to improve it. I looked around the gallery for useful
examples,
 and the closest I could find is the twinx/twiny function, but I
didn't
 manage a plot that put one data curve across both axes.

 This code gives an image that maybe explains what I'm trying to
do:

 ===
 t = array([0,1,2,4,6,9,12,24])
 y = array([100, 50, 10, 100, 5, 1, 0, 0])
 subplot(111, xscale=linear, yscale=log)
 errorbar(x, y, yerr=0.4*y)
 linbit = axes([0.125, 0.1, 0.775, 0.1],frameon=False)
 linbit.xaxis.set_visible(False)
 for tl in linbit.get_yticklabels():
  tl.set_color('r')
 show()
 ===

 (the y=0 points should be plotted and connected to the line in
the
 log part)

 Is this possible to do in matplotlib? Could someone give me a
pointer
 on how to go on?

 Sorry for the long mail,

 /C


   

--

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





--




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




Re: [Matplotlib-users] linearized log axis

2010-05-20 Thread Michael Droettboom
Yep.  That's a bug.  Here's a patch to fix it:

ndex: lib/matplotlib/ticker.py
===
--- lib/matplotlib/ticker.py(revision 8323)
+++ lib/matplotlib/ticker.py(working copy)
@@ -1178,16 +1178,21 @@

  def decade_down(x, base=10):
  'floor x to the nearest lower decade'
-
+if x == 0.0:
+return -base
  lx = math.floor(math.log(x)/math.log(base))
  return base**lx

  def decade_up(x, base=10):
  'ceil x to the nearest higher decade'
+if x == 0.0:
+return base
  lx = math.ceil(math.log(x)/math.log(base))
  return base**lx

  def is_decade(x,base=10):
+if x == 0.0:
+return True
  lx = math.log(x)/math.log(base)
  return lx==int(lx)

Mike

On 05/20/2010 09:43 AM, Christer wrote:
 Thank you for the help, I never knew what the symlog flag did actually.

 However, there is still a slight problem:

 =
 x = array([0,1,2,4,6,9,12,24])
 y = array([100, 50, 10, 100, 5, 1, 1, 1])
 subplot(111)
 plot(x, y)
 yscale('symlog')
 xscale=('linear')
 ylim(-1,1000)
 show()
 =

 The plot looks exactly like I want it, the problem is when I change
 the 1's to 0's in the y-array, then I get a:

 File C:\Python26\lib\site-packages\matplotlib\ticker.py, line 1029,
 in is_decade
   lx = math.log(x)/math.log(base)
 ValueError: math domain error

 I suppose that means somewhere a log(0) is attempted. This kind of
 defeats the purpose...

 /C

 Quoting Eric Firingefir...@hawaii.edu:


 On 05/19/2010 10:28 AM, Benjamin Root wrote:
  
 Maybe I am misunderstanding your problem, but you can select

 'semilog'

 for the x/yscale parameter.

 You mean symlog.

 See

  
 http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html

 Although the example doesn't show it, the axis limits don't have to be
 symmetric.  For example, on the top plot, you can use

 gca().set_xlim([0, 100])

 to show only the right-hand side.

 Eric


  
 Ben Root

 On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg
 christer.malmberg.0...@student.uu.se
 mailto:christer.malmberg.0...@student.uu.se  wrote:

  Hi,

  my problem is that I need a graph with a discontinous y-axis. Let

 me

  explain the problem: in my field (microbiology) the data

 generated

  from for example growth assays have a huge range (10^0-10^9),

 which

  has to be plotted on a semilogy style plot (cell concentration

 vs.

  time). The problem is that 0 cells is a useful number to plot
  (indicates cell concentration lower than detection limit), but of
  course not possible to show in a log diagram. This is easily

 solved on

  old-style logarithmic graph paper; since the data will be either

 0, or

   1 it is customary just to draw a zero x-axis at 10^-1 on the

 paper

  and that's that. On the computer, this is extremely hard. Most

 people

  I know resort to various tricks in Excel, such as entering a

 small

  number (0.001 etc) and starting the y-axis range from 10^1 to

 hide the

  problem. This makes excel draw a line, instead of leaving out the

 dot

  and line entirely. The part of the curve below the x-axis is then
  manually cut off in a suitable image editor. Needless to say,

 this is

  extremely kludgy. Even professional graphing packages like

 Graphpad

  Prism resort to similar kludges (re-define 0 values to 0.1,

 change the

  y-axis tick label to 0 etc.) This problem of course exists in

 other

  fields, while investigating a solution I found a guy who worked

 with

  aerosol contamination in clean rooms, and he needed to plot

 values

  logarithmically, at the same time as showing detector noise

 around

  1-10 particles. He solved it by the same trick I would like to do

 in

  Matplotlib, namely plotting a standard semilogy plot but with the
  10^-1 to 10^0 decade being replaced by a 0-1 linear axis on the

 same

  side.

  The guy in this post has the same problem and a useful example:
  http://ubuntuforums.org/showthread.php?t=394851

  His partial solution is quite bad though, and I just got stuck

 while

  trying to improve it. I looked around the gallery for useful

 examples,

  and the closest I could find is the twinx/twiny function, but I

 didn't

  manage a plot that put one data curve across both axes.

  This code gives an image that maybe explains what I'm trying to

 do:

  ===
  

Re: [Matplotlib-users] linearized log axis

2010-05-20 Thread Benjamin Root
Do we really want to depend on a floating point equality?

Ben Root

On Thu, May 20, 2010 at 9:02 AM, Michael Droettboom md...@stsci.edu wrote:

 Yep.  That's a bug.  Here's a patch to fix it:

 ndex: lib/matplotlib/ticker.py
 ===
 --- lib/matplotlib/ticker.py(revision 8323)
 +++ lib/matplotlib/ticker.py(working copy)
 @@ -1178,16 +1178,21 @@

  def decade_down(x, base=10):
  'floor x to the nearest lower decade'
 -
 +if x == 0.0:
 +return -base
  lx = math.floor(math.log(x)/math.log(base))
  return base**lx

  def decade_up(x, base=10):
  'ceil x to the nearest higher decade'
 +if x == 0.0:
 +return base
  lx = math.ceil(math.log(x)/math.log(base))
  return base**lx

  def is_decade(x,base=10):
 +if x == 0.0:
 +return True
   lx = math.log(x)/math.log(base)
   return lx==int(lx)

 Mike

 On 05/20/2010 09:43 AM, Christer wrote:
  Thank you for the help, I never knew what the symlog flag did actually.
 
  However, there is still a slight problem:
 
  =
  x = array([0,1,2,4,6,9,12,24])
  y = array([100, 50, 10, 100, 5, 1, 1, 1])
  subplot(111)
  plot(x, y)
  yscale('symlog')
  xscale=('linear')
  ylim(-1,1000)
  show()
  =
 
  The plot looks exactly like I want it, the problem is when I change
  the 1's to 0's in the y-array, then I get a:
 
  File C:\Python26\lib\site-packages\matplotlib\ticker.py, line 1029,
  in is_decade
lx = math.log(x)/math.log(base)
  ValueError: math domain error
 
  I suppose that means somewhere a log(0) is attempted. This kind of
  defeats the purpose...
 
  /C
 
  Quoting Eric Firingefir...@hawaii.edu:
 
 
  On 05/19/2010 10:28 AM, Benjamin Root wrote:
 
  Maybe I am misunderstanding your problem, but you can select
 
  'semilog'
 
  for the x/yscale parameter.
 
  You mean symlog.
 
  See
 
 
 
 http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html
 
  Although the example doesn't show it, the axis limits don't have to be
  symmetric.  For example, on the top plot, you can use
 
  gca().set_xlim([0, 100])
 
  to show only the right-hand side.
 
  Eric
 
 
 
  Ben Root
 
  On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg
  christer.malmberg.0...@student.uu.se
  mailto:christer.malmberg.0...@student.uu.se  wrote:
 
   Hi,
 
   my problem is that I need a graph with a discontinous y-axis. Let
 
  me
 
   explain the problem: in my field (microbiology) the data
 
  generated
 
   from for example growth assays have a huge range (10^0-10^9),
 
  which
 
   has to be plotted on a semilogy style plot (cell concentration
 
  vs.
 
   time). The problem is that 0 cells is a useful number to plot
   (indicates cell concentration lower than detection limit), but of
   course not possible to show in a log diagram. This is easily
 
  solved on
 
   old-style logarithmic graph paper; since the data will be either
 
  0, or
 
1 it is customary just to draw a zero x-axis at 10^-1 on the
 
  paper
 
   and that's that. On the computer, this is extremely hard. Most
 
  people
 
   I know resort to various tricks in Excel, such as entering a
 
  small
 
   number (0.001 etc) and starting the y-axis range from 10^1 to
 
  hide the
 
   problem. This makes excel draw a line, instead of leaving out the
 
  dot
 
   and line entirely. The part of the curve below the x-axis is then
   manually cut off in a suitable image editor. Needless to say,
 
  this is
 
   extremely kludgy. Even professional graphing packages like
 
  Graphpad
 
   Prism resort to similar kludges (re-define 0 values to 0.1,
 
  change the
 
   y-axis tick label to 0 etc.) This problem of course exists in
 
  other
 
   fields, while investigating a solution I found a guy who worked
 
  with
 
   aerosol contamination in clean rooms, and he needed to plot
 
  values
 
   logarithmically, at the same time as showing detector noise
 
  around
 
   1-10 particles. He solved it by the same trick I would like to do
 
  in
 
   Matplotlib, namely plotting a standard semilogy plot but with the
   10^-1 to 10^0 decade being replaced by a 0-1 linear axis on the
 
  same
 
   side.
 
   The guy in this post has the same problem and a useful example:
   http://ubuntuforums.org/showthread.php?t=394851
 
   His partial solution is quite bad though, and I just got stuck
 
  while
 
   trying to improve it. I looked around the gallery for useful
 
  examples,
 
   and the closest I could find is the twinx/twiny function, but I
 
  didn't
 
   manage a plot that put one data curve across both axes.
 
   This code gives an image that maybe explains what I'm trying to
 
  do:
 
   ===
 

[Matplotlib-users] variant not working in text()...

2010-05-20 Thread Nick Schurch
Hi all,

I'm adding some text to a plt like this:

import mapplotlib.pyplot as plt
fig=plt.figure()
plt.text(0.5,0.5,some text, variant='small-caps')

but the text that is plotted is not small caps, its just normal. Is
this a bug or am I doing something wrong?

-- 
Cheers,

Nick Schurch

Data Analysis Group (The Barton Group),
School of Life Sciences,
University of Dundee,
Dow St,
Dundee,
DD1 5EH,
Scotland,
UK

Tel: +44 1382 388707
Fax: +44 1382 345 893

--

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


Re: [Matplotlib-users] linearized log axis

2010-05-20 Thread Michael Droettboom
In this case, yes.  The assumption of these (private) functions is that 
x will be non-negative.  The only case where we need to worry about log 
raising an exception is with exactly 0.

Mike

On 05/20/2010 10:08 AM, Benjamin Root wrote:
 Do we really want to depend on a floating point equality?

 Ben Root

 On Thu, May 20, 2010 at 9:02 AM, Michael Droettboommd...@stsci.edu  wrote:


 Yep.  That's a bug.  Here's a patch to fix it:

 ndex: lib/matplotlib/ticker.py
 ===
 --- lib/matplotlib/ticker.py(revision 8323)
 +++ lib/matplotlib/ticker.py(working copy)
 @@ -1178,16 +1178,21 @@

   def decade_down(x, base=10):
   'floor x to the nearest lower decade'
 -
 +if x == 0.0:
 +return -base
   lx = math.floor(math.log(x)/math.log(base))
   return base**lx

   def decade_up(x, base=10):
   'ceil x to the nearest higher decade'
 +if x == 0.0:
 +return base
   lx = math.ceil(math.log(x)/math.log(base))
   return base**lx

   def is_decade(x,base=10):
 +if x == 0.0:
 +return True
lx = math.log(x)/math.log(base)
return lx==int(lx)

 Mike

 On 05/20/2010 09:43 AM, Christer wrote:
  
 Thank you for the help, I never knew what the symlog flag did actually.

 However, there is still a slight problem:

 =
 x = array([0,1,2,4,6,9,12,24])
 y = array([100, 50, 10, 100, 5, 1, 1, 1])
 subplot(111)
 plot(x, y)
 yscale('symlog')
 xscale=('linear')
 ylim(-1,1000)
 show()
 =

 The plot looks exactly like I want it, the problem is when I change
 the 1's to 0's in the y-array, then I get a:

 File C:\Python26\lib\site-packages\matplotlib\ticker.py, line 1029,
 in is_decade
lx = math.log(x)/math.log(base)
 ValueError: math domain error

 I suppose that means somewhere a log(0) is attempted. This kind of
 defeats the purpose...

 /C

 Quoting Eric Firingefir...@hawaii.edu:



 On 05/19/2010 10:28 AM, Benjamin Root wrote:

  
 Maybe I am misunderstanding your problem, but you can select


 'semilog'


 for the x/yscale parameter.


 You mean symlog.

 See


  

 http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html
  

 Although the example doesn't show it, the axis limits don't have to be
 symmetric.  For example, on the top plot, you can use

 gca().set_xlim([0, 100])

 to show only the right-hand side.

 Eric



  
 Ben Root

 On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg
 christer.malmberg.0...@student.uu.se
 mailto:christer.malmberg.0...@student.uu.se   wrote:

   Hi,

   my problem is that I need a graph with a discontinous y-axis. Let


 me


   explain the problem: in my field (microbiology) the data


 generated


   from for example growth assays have a huge range (10^0-10^9),


 which


   has to be plotted on a semilogy style plot (cell concentration


 vs.


   time). The problem is that 0 cells is a useful number to plot
   (indicates cell concentration lower than detection limit), but of
   course not possible to show in a log diagram. This is easily


 solved on


   old-style logarithmic graph paper; since the data will be either


 0, or


1 it is customary just to draw a zero x-axis at 10^-1 on the


 paper


   and that's that. On the computer, this is extremely hard. Most


 people


   I know resort to various tricks in Excel, such as entering a


 small


   number (0.001 etc) and starting the y-axis range from 10^1 to


 hide the


   problem. This makes excel draw a line, instead of leaving out the


 dot


   and line entirely. The part of the curve below the x-axis is then
   manually cut off in a suitable image editor. Needless to say,


 this is


   extremely kludgy. Even professional graphing packages like


 Graphpad


   Prism resort to similar kludges (re-define 0 values to 0.1,


 change the


   y-axis tick label to 0 etc.) This problem of course exists in


 other


   fields, while investigating a solution I found a guy who worked


 with


   aerosol contamination in clean rooms, and he needed to plot


 values


   logarithmically, at the same time as showing detector noise


 around


   1-10 particles. He solved it by the same trick I would like to do


 in


   Matplotlib, namely plotting a standard semilogy plot but with the
   

[Matplotlib-users] Another text problem...

2010-05-20 Thread Nick Schurch
I've also discovered another text problem. If I add two lines of test
to a plot as follows:

import mapplotlib.pyplot as plt
fig=plt.figure()
plt.text(0.4,0.5,some text)
plt.text(0.6,0.5,some more text)

then the two sets of text line up nicely with each other, because they
have the same y-axis position. But if I do:

import mapplotlib.pyplot as plt
fig=plt.figure()
plt.text(0.4,0.5,some text)
plt.text(0.6,0.5,some text with a g in it)

then the some text with a g in it is shifted upwards slightly so
that the bottom of some text lines up with the bottom of the g,
and doesn't line up witht he rest of the letters. It look like they
are not on the same line! This has got to be a bug in the way
matplotlib deals with text.

--
Cheers,

Nick Schurch

Data Analysis Group (The Barton Group),
School of Life Sciences,
University of Dundee,
Dow St,
Dundee,
DD1 5EH,
Scotland,
UK

Tel: +44 1382 388707
Fax: +44 1382 345 893



-- 
Cheers,

Nick Schurch

Data Analysis Group (The Barton Group),
School of Life Sciences,
University of Dundee,
Dow St,
Dundee,
DD1 5EH,
Scotland,
UK

Tel: +44 1382 388707
Fax: +44 1382 345 893

--

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


Re: [Matplotlib-users] variant not working in text()...

2010-05-20 Thread Michael Droettboom
That will only work if you have a small-caps variant of the font 
installed (which the vast majority of fonts do not).  matplotlib does 
not do any font synthesis at all -- i.e. it does not create a pseudo 
font variation when one does not exist on disk.

Mike

On 05/20/2010 10:19 AM, Nick Schurch wrote:
 Hi all,

 I'm adding some text to a plt like this:

 import mapplotlib.pyplot as plt
 fig=plt.figure()
 plt.text(0.5,0.5,some text, variant='small-caps')

 but the text that is plotted is not small caps, its just normal. Is
 this a bug or am I doing something wrong?




-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


--

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


Re: [Matplotlib-users] Another text problem...

2010-05-20 Thread Michael Droettboom
It is a bug, but the broken behavior was kept for backward 
compatibility.  Try setting the vertical alignment to 'baseline'.

import matplotlib.pyplot as plt
fig=plt.figure()
plt.text(0.4,0.5,some text, verticalalignment='baseline')
plt.text(0.6,0.5,some text with a g in it, verticalalignment='baseline')

It's probably about time to fix this -- we will have to update many of 
the unit tests -- what do the rest of the devs think?

Mike

On 05/20/2010 10:28 AM, Nick Schurch wrote:
 I've also discovered another text problem. If I add two lines of test
 to a plot as follows:

 import mapplotlib.pyplot as plt
 fig=plt.figure()
 plt.text(0.4,0.5,some text)
 plt.text(0.6,0.5,some more text)

 then the two sets of text line up nicely with each other, because they
 have the same y-axis position. But if I do:

 import mapplotlib.pyplot as plt
 fig=plt.figure()
 plt.text(0.4,0.5,some text)
 plt.text(0.6,0.5,some text with a g in it)

 then the some text with a g in it is shifted upwards slightly so
 that the bottom of some text lines up with the bottom of the g,
 and doesn't line up witht he rest of the letters. It look like they
 are not on the same line! This has got to be a bug in the way
 matplotlib deals with text.

 --
 Cheers,

 Nick Schurch

 Data Analysis Group (The Barton Group),
 School of Life Sciences,
 University of Dundee,
 Dow St,
 Dundee,
 DD1 5EH,
 Scotland,
 UK

 Tel: +44 1382 388707
 Fax: +44 1382 345 893






-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


--

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


Re: [Matplotlib-users] linearized log axis

2010-05-20 Thread Benjamin Root
Ok, good, I just wanted to do a sanity check.

On Thu, May 20, 2010 at 9:21 AM, Michael Droettboom md...@stsci.edu wrote:

 In this case, yes.  The assumption of these (private) functions is that
 x will be non-negative.  The only case where we need to worry about log
 raising an exception is with exactly 0.

 Mike

 On 05/20/2010 10:08 AM, Benjamin Root wrote:
  Do we really want to depend on a floating point equality?
 
  Ben Root
 
  On Thu, May 20, 2010 at 9:02 AM, Michael Droettboommd...@stsci.edu
  wrote:
 
 
  Yep.  That's a bug.  Here's a patch to fix it:
 
  ndex: lib/matplotlib/ticker.py
  ===
  --- lib/matplotlib/ticker.py(revision 8323)
  +++ lib/matplotlib/ticker.py(working copy)
  @@ -1178,16 +1178,21 @@
 
def decade_down(x, base=10):
'floor x to the nearest lower decade'
  -
  +if x == 0.0:
  +return -base
lx = math.floor(math.log(x)/math.log(base))
return base**lx
 
def decade_up(x, base=10):
'ceil x to the nearest higher decade'
  +if x == 0.0:
  +return base
lx = math.ceil(math.log(x)/math.log(base))
return base**lx
 
def is_decade(x,base=10):
  +if x == 0.0:
  +return True
 lx = math.log(x)/math.log(base)
 return lx==int(lx)
 
  Mike
 
  On 05/20/2010 09:43 AM, Christer wrote:
 
  Thank you for the help, I never knew what the symlog flag did actually.
 
  However, there is still a slight problem:
 
  =
  x = array([0,1,2,4,6,9,12,24])
  y = array([100, 50, 10, 100, 5, 1, 1, 1])
  subplot(111)
  plot(x, y)
  yscale('symlog')
  xscale=('linear')
  ylim(-1,1000)
  show()
  =
 
  The plot looks exactly like I want it, the problem is when I change
  the 1's to 0's in the y-array, then I get a:
 
  File C:\Python26\lib\site-packages\matplotlib\ticker.py, line 1029,
  in is_decade
 lx = math.log(x)/math.log(base)
  ValueError: math domain error
 
  I suppose that means somewhere a log(0) is attempted. This kind of
  defeats the purpose...
 
  /C
 
  Quoting Eric Firingefir...@hawaii.edu:
 
 
 
  On 05/19/2010 10:28 AM, Benjamin Root wrote:
 
 
  Maybe I am misunderstanding your problem, but you can select
 
 
  'semilog'
 
 
  for the x/yscale parameter.
 
 
  You mean symlog.
 
  See
 
 
 
 
 
 http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html
 
 
  Although the example doesn't show it, the axis limits don't have to be
  symmetric.  For example, on the top plot, you can use
 
  gca().set_xlim([0, 100])
 
  to show only the right-hand side.
 
  Eric
 
 
 
 
  Ben Root
 
  On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg
  christer.malmberg.0...@student.uu.se
  mailto:christer.malmberg.0...@student.uu.se   wrote:
 
Hi,
 
my problem is that I need a graph with a discontinous y-axis.
 Let
 
 
  me
 
 
explain the problem: in my field (microbiology) the data
 
 
  generated
 
 
from for example growth assays have a huge range (10^0-10^9),
 
 
  which
 
 
has to be plotted on a semilogy style plot (cell concentration
 
 
  vs.
 
 
time). The problem is that 0 cells is a useful number to plot
(indicates cell concentration lower than detection limit), but
 of
course not possible to show in a log diagram. This is easily
 
 
  solved on
 
 
old-style logarithmic graph paper; since the data will be
 either
 
 
  0, or
 
 
 1 it is customary just to draw a zero x-axis at 10^-1 on the
 
 
  paper
 
 
and that's that. On the computer, this is extremely hard. Most
 
 
  people
 
 
I know resort to various tricks in Excel, such as entering a
 
 
  small
 
 
number (0.001 etc) and starting the y-axis range from 10^1 to
 
 
  hide the
 
 
problem. This makes excel draw a line, instead of leaving out
 the
 
 
  dot
 
 
and line entirely. The part of the curve below the x-axis is
 then
manually cut off in a suitable image editor. Needless to say,
 
 
  this is
 
 
extremely kludgy. Even professional graphing packages like
 
 
  Graphpad
 
 
Prism resort to similar kludges (re-define 0 values to 0.1,
 
 
  change the
 
 
y-axis tick label to 0 etc.) This problem of course exists in
 
 
  other
 
 
fields, while investigating a solution I found a guy who worked
 
 
  with
 
 
aerosol contamination in clean rooms, and he needed to plot
 
 
  values
 
 
logarithmically, at the same time as showing detector noise
 
 
  around
 
 
1-10 particles. He solved it by the same trick I would like to
 do
 
 
  in
 
 
Matplotlib, namely plotting a standard semilogy plot but with
 the
10^-1 to 10^0 decade being replaced by a 0-1 linear axis on the
 
 
  same
 
 
side.
 
The guy in 

Re: [Matplotlib-users] Another text problem...

2010-05-20 Thread Ryan May
On Thu, May 20, 2010 at 9:34 AM, Michael Droettboom md...@stsci.edu wrote:
 It is a bug, but the broken behavior was kept for backward
 compatibility.  Try setting the vertical alignment to 'baseline'.

 import matplotlib.pyplot as plt
 fig=plt.figure()
 plt.text(0.4,0.5,some text, verticalalignment='baseline')
 plt.text(0.6,0.5,some text with a g in it, verticalalignment='baseline')

 It's probably about time to fix this -- we will have to update many of
 the unit tests -- what do the rest of the devs think?

I'm +1, but I've been bitten by this and am not concerned personally
with the backwards incompatibility. I'm not sure how much code out
there is dependant on this.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--

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


Re: [Matplotlib-users] Another text problem...

2010-05-20 Thread Michael Droettboom
On 05/20/2010 11:32 AM, Ryan May wrote:
 On Thu, May 20, 2010 at 9:34 AM, Michael Droettboommd...@stsci.edu  wrote:

 It is a bug, but the broken behavior was kept for backward
 compatibility.  Try setting the vertical alignment to 'baseline'.

 import matplotlib.pyplot as plt
 fig=plt.figure()
 plt.text(0.4,0.5,some text, verticalalignment='baseline')
 plt.text(0.6,0.5,some text with a g in it, verticalalignment='baseline')

 It's probably about time to fix this -- we will have to update many of
 the unit tests -- what do the rest of the devs think?
  
 I'm +1, but I've been bitten by this and am not concerned personally
 with the backwards incompatibility. I'm not sure how much code out
 there is dependant on this.


I've made baseline the default in SVN r8330.  Only two of the unit tests 
changed due to this -- so hopefully it won't be too disruptive for users 
at large.

Mike

-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


--

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


Re: [Matplotlib-users] linearized log axis

2010-05-20 Thread Eric Firing
On 05/19/2010 11:31 PM, Christer Malmberg wrote:
 Thank you for the help, I never knew what the symlog flag did actually.

 However, there is still a slight problem:

 =
 x = array([0,1,2,4,6,9,12,24])
 y = array([100, 50, 10, 100, 5, 1, 1, 1])
 subplot(111)
 plot(x, y)
 yscale('symlog')
 xscale=('linear')
 ylim(-1,1000)
 show()
 =

 The plot looks exactly like I want it, the problem is when I change the
 1's to 0's in the y-array, then I get a:

 File C:\Python26\lib\site-packages\matplotlib\ticker.py, line 1029, in
 is_decade
 lx = math.log(x)/math.log(base)
 ValueError: math domain error

 I suppose that means somewhere a log(0) is attempted. This kind of
 defeats the purpose...

Yes, it looks like a bug that can be fixed fairly easily.  In the 
meantime, a workaround is to add the kwarg scaley=False to your call 
to plot; or more generally, do something like

ax = subplot(111)
ax.set_autoscaley_on(False)

before proceeding with any plotting commands.

Eric



 /C

 Quoting Eric Firing efir...@hawaii.edu:

 On 05/19/2010 10:28 AM, Benjamin Root wrote:
 Maybe I am misunderstanding your problem, but you can select 'semilog'
 for the x/yscale parameter.

 You mean symlog.

 See
 http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html


 Although the example doesn't show it, the axis limits don't have to be
 symmetric. For example, on the top plot, you can use

 gca().set_xlim([0, 100])

 to show only the right-hand side.

 Eric



 Ben Root

 On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg
 christer.malmberg.0...@student.uu.se
 mailto:christer.malmberg.0...@student.uu.se wrote:

 Hi,

 my problem is that I need a graph with a discontinous y-axis. Let me
 explain the problem: in my field (microbiology) the data generated
 from for example growth assays have a huge range (10^0-10^9), which
 has to be plotted on a semilogy style plot (cell concentration vs.
 time). The problem is that 0 cells is a useful number to plot
 (indicates cell concentration lower than detection limit), but of
 course not possible to show in a log diagram. This is easily solved on
 old-style logarithmic graph paper; since the data will be either 0, or
 1 it is customary just to draw a zero x-axis at 10^-1 on the paper
 and that's that. On the computer, this is extremely hard. Most people
 I know resort to various tricks in Excel, such as entering a small
 number (0.001 etc) and starting the y-axis range from 10^1 to hide the
 problem. This makes excel draw a line, instead of leaving out the dot
 and line entirely. The part of the curve below the x-axis is then
 manually cut off in a suitable image editor. Needless to say, this is
 extremely kludgy. Even professional graphing packages like Graphpad
 Prism resort to similar kludges (re-define 0 values to 0.1, change the
 y-axis tick label to 0 etc.) This problem of course exists in other
 fields, while investigating a solution I found a guy who worked with
 aerosol contamination in clean rooms, and he needed to plot values
 logarithmically, at the same time as showing detector noise around
 1-10 particles. He solved it by the same trick I would like to do in
 Matplotlib, namely plotting a standard semilogy plot but with the
 10^-1 to 10^0 decade being replaced by a 0-1 linear axis on the same
 side.

 The guy in this post has the same problem and a useful example:
 http://ubuntuforums.org/showthread.php?t=394851

 His partial solution is quite bad though, and I just got stuck while
 trying to improve it. I looked around the gallery for useful examples,
 and the closest I could find is the twinx/twiny function, but I didn't
 manage a plot that put one data curve across both axes.

 This code gives an image that maybe explains what I'm trying to do:

 ===
 t = array([0,1,2,4,6,9,12,24])
 y = array([100, 50, 10, 100, 5, 1, 0, 0])
 subplot(111, xscale=linear, yscale=log)
 errorbar(x, y, yerr=0.4*y)
 linbit = axes([0.125, 0.1, 0.775, 0.1],frameon=False)
 linbit.xaxis.set_visible(False)
 for tl in linbit.get_yticklabels():
 tl.set_color('r')
 show()
 ===

 (the y=0 points should be plotted and connected to the line in the
 log part)

 Is this possible to do in matplotlib? Could someone give me a pointer
 on how to go on?

 Sorry for the long mail,

 /C


 --


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




 --





 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 

[Matplotlib-users] LaTeX error on semilogy + usetex + SubplotHost

2010-05-20 Thread João Luís Silva
Hi,

I ran into a bug where I get the LaTeX error:

RuntimeError: LaTeX was not able to process the following string: 

''

I know it's an uncommon plot, but I need extra (non-uniform) tick labels 
at the top so I'm using SubplotHost, on a semilog plot with usetex (so 
the fonts look similar to the ones on the paper).

Matplotlib svn r8330 on Ubuntu 9.10.

Regards,
João Silva

Example script: -

from matplotlib import rc
rc('text', usetex=True)

from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure(1)
ax = SubplotHost(fig, 111)
fig.add_subplot(ax)
x = np.arange(1.0,10.0,0.1)
ax.semilogy(x,x**2)
plt.show()

-


--

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


Re: [Matplotlib-users] LaTeX error on semilogy + usetex + SubplotHost

2010-05-20 Thread Jae-Joon Lee
I cannot reproduce this error.
I'm using r8330 on Linux.

I guess the error does not occur when you use a normal subplot?

Just in case, replace axes_grid with axes_grid1 and see if it makes
any difference, i.e.,

from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost

Regards,

-JJ


On Thu, May 20, 2010 at 2:11 PM, João Luís Silva jsi...@fc.up.pt wrote:
 Hi,

 I ran into a bug where I get the LaTeX error:

 RuntimeError: LaTeX was not able to process the following string:

 ''

 I know it's an uncommon plot, but I need extra (non-uniform) tick labels
 at the top so I'm using SubplotHost, on a semilog plot with usetex (so
 the fonts look similar to the ones on the paper).

 Matplotlib svn r8330 on Ubuntu 9.10.

 Regards,
 João Silva

 Example script: -

 from matplotlib import rc
 rc('text', usetex=True)

 from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
 import numpy as np
 import matplotlib.pyplot as plt

 fig = plt.figure(1)
 ax = SubplotHost(fig, 111)
 fig.add_subplot(ax)
 x = np.arange(1.0,10.0,0.1)
 ax.semilogy(x,x**2)
 plt.show()

 -


 --

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


--

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


Re: [Matplotlib-users] LaTeX error on semilogy + usetex + SubplotHost

2010-05-20 Thread Michael Droettboom
The following patch avoids the error with your attached plot.  I'm sure 
if it the right fix though -- I'm not sure why empty strings are being 
sent this far along, and I'm also not seeing any ticks along the top.

Mike

Index: lib/matplotlib/texmanager.py
===
--- lib/matplotlib/texmanager.py(revision 8329)
+++ lib/matplotlib/texmanager.py(working copy)
@@ -578,6 +578,9 @@
  return width, heigth and descent of the text.
  

+if tex.strip() == '':
+return 0, 0, 0
+
  if renderer:
  dpi_fraction = renderer.points_to_pixels(1.)
  else:


On 05/20/2010 02:11 PM, João Luís Silva wrote:
 from matplotlib import rc
 rc('text', usetex=True)

 from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
 import numpy as np
 import matplotlib.pyplot as plt

 fig = plt.figure(1)
 ax = SubplotHost(fig, 111)
 fig.add_subplot(ax)
 x = np.arange(1.0,10.0,0.1)
 ax.semilogy(x,x**2)
 plt.show()



-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


--

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


Re: [Matplotlib-users] LaTeX error on semilogy + usetex + SubplotHost

2010-05-20 Thread Michael Droettboom
The error may be dependent on the version of latex being used.  Yours 
may be handling the empty content just fine.  (I'm using TexLive 2009 on 
RHEL5).

Mike

On 05/20/2010 02:34 PM, Jae-Joon Lee wrote:
 I cannot reproduce this error.
 I'm using r8330 on Linux.

 I guess the error does not occur when you use a normal subplot?

 Just in case, replace axes_grid with axes_grid1 and see if it makes
 any difference, i.e.,

 from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost

 Regards,

 -JJ


 On Thu, May 20, 2010 at 2:11 PM, João Luís Silvajsi...@fc.up.pt  wrote:

 Hi,

 I ran into a bug where I get the LaTeX error:

 RuntimeError: LaTeX was not able to process the following string:

 ''

 I know it's an uncommon plot, but I need extra (non-uniform) tick labels
 at the top so I'm using SubplotHost, on a semilog plot with usetex (so
 the fonts look similar to the ones on the paper).

 Matplotlib svn r8330 on Ubuntu 9.10.

 Regards,
 João Silva

 Example script: -

 from matplotlib import rc
 rc('text', usetex=True)

 from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
 import numpy as np
 import matplotlib.pyplot as plt

 fig = plt.figure(1)
 ax = SubplotHost(fig, 111)
 fig.add_subplot(ax)
 x = np.arange(1.0,10.0,0.1)
 ax.semilogy(x,x**2)
 plt.show()

 -


 --

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

  
 --

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



-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


--

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


Re: [Matplotlib-users] How to have few marks on the lines?

2010-05-20 Thread Jae-Joon Lee
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot

use *markevery* keyword.

http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D.set_markevery

If you want more control, you can always draws the lines (without
markers) first and overplot markers in positions you want separately.

Regards,

-JJ



On Wed, May 19, 2010 at 11:56 AM, Omer Khalid omer.kha...@cern.ch wrote:
 Hi,
 I am a wondering if it's possible to have few line distinguishing marks on
 the data lines on a chart such as circle, start, square. When I use some
 thing like this for the color of the graph (i.e. rs, k^), it uses the shape
 for each data point and the lines becomes very thick. All I want is to put
 4-5 shaper markers on each line with line (the data line will have few
 hundred data points).
 Many thanks,
 Omer
 --


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



--

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


Re: [Matplotlib-users] LaTeX error on semilogy + usetex + SubplotHost

2010-05-20 Thread Jae-Joon Lee
It turns out that when axes_grid toolkit is used and there are some
ticks does not have associated ticklabels (i.e., minor ticks), it
tries to call the get_texts_widths_heights_descents method with
empty string.
The following patch prevent this.

--- a/lib/mpl_toolkits/axisartist/axis_artist.py
+++ b/lib/mpl_toolkits/axisartist/axis_artist.py
@@ -769,6 +769,7 @@ class TickLabels(AxisLabel, AttributeCopier): # mtext.Text
 #self._set_offset_radius(r)

 for (x, y), a, l in self._locs_angles_labels:
+if not l.strip(): continue
 self._set_ref_angle(a) #+ add_angle
 self.set_x(x)
 self.set_y(y)
@@ -811,6 +812,7 @@ class TickLabels(AxisLabel, AttributeCopier): # mtext.Text
 
 whd_list = []
 for (x, y), a, l in self._locs_angles_labels:
+if not l.strip(): continue
 clean_line, ismath = self.is_math_text(l)
 whd = renderer.get_text_width_height_descent(
 clean_line, self._fontproperties, ismath=ismath)


But it may be still safer to return 0,0,0 when empty string is given
for *get_texts_widths_heights_descents*?
Regards,

-JJ



On Thu, May 20, 2010 at 2:36 PM, Michael Droettboom md...@stsci.edu wrote:
 The following patch avoids the error with your attached plot.  I'm sure
 if it the right fix though -- I'm not sure why empty strings are being
 sent this far along, and I'm also not seeing any ticks along the top.

 Mike

 Index: lib/matplotlib/texmanager.py
 ===
 --- lib/matplotlib/texmanager.py    (revision 8329)
 +++ lib/matplotlib/texmanager.py    (working copy)
 @@ -578,6 +578,9 @@
          return width, heigth and descent of the text.
          

 +        if tex.strip() == '':
 +            return 0, 0, 0
 +
          if renderer:
              dpi_fraction = renderer.points_to_pixels(1.)
          else:


 On 05/20/2010 02:11 PM, João Luís Silva wrote:
 from matplotlib import rc
 rc('text', usetex=True)

 from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
 import numpy as np
 import matplotlib.pyplot as plt

 fig = plt.figure(1)
 ax = SubplotHost(fig, 111)
 fig.add_subplot(ax)
 x = np.arange(1.0,10.0,0.1)
 ax.semilogy(x,x**2)
 plt.show()



 --
 Michael Droettboom
 Science Software Branch
 Space Telescope Science Institute
 Baltimore, Maryland, USA


 --

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


--

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


Re: [Matplotlib-users] get_tick{label}s: are tick labels drawn?

2010-05-20 Thread Jae-Joon Lee
Like the gridlines, these are determined during the drawing time.

Each tick instances have

tick1On
tick2On
label1On
label2On

attributes that controls whether to draw tick (or ticklabel) or not.
Again, note that not all ticks that are returned by get_xticks()
methods may be actually drawn.

-JJ


On Sat, May 8, 2010 at 4:36 AM, Nico Schlömer nico.schloe...@gmail.com wrote:
 Hi,

 say, is there a way to query an axis object whether or not the tick
 labels are drawn?

 I looked at -- one the x-axis -- get_xticks( and get_xticklabels()
 which in two different situations would spit out a list of doubles
 (the tick positions) and a list of text entries of the form
 Text(0,0,''). In one plot, though, the tick labels are drawn, not in
 the other one.

 Cheers,
 Nico

 --

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


--

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


Re: [Matplotlib-users] get_tick{label}s: are tick labels drawn?

2010-05-20 Thread Jae-Joon Lee
On Thu, May 20, 2010 at 3:17 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote:
 Again, note that not all ticks that are returned by get_xticks()
 methods may be actually drawn.


I mean, even if their tick1On (and others) is True.

-JJ

--

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


Re: [Matplotlib-users] get_tick{label}s: are tick labels drawn?

2010-05-20 Thread Jae-Joon Lee
On Mon, May 10, 2010 at 12:19 PM, Nico Schlömer
nico.schloe...@gmail.com wrote:
 When tick labels are explicitly supplied, that may not actually
 reflect in the return result of get_ticks. Specifically, I set the
 tick labels in a color bar, but get_ticklabels() returns a list of
 empty text objects Text(0,0,'').
 For regular axes, that seems to work better.


How did you set your ticklabels?
Again, matplotlib does not guarantee that all ticks that are returned
by get_ticks() will be actually drawn. On other words, get_ticks may
return ticks that are meaningless (and this is not a bug).
Also, colorbar axes works slightly differently from normal axes, but
I'm not sure if this is related with your problem.

As far as I can say, the use of get_ticks(), get_ticklabels() and etc
method should be limited to when you want to view/change their artist
attributes (like colors, etc.). You should not rely on this to
determine things like, whether some ticks will be drawn, locations of
ticks, and etc.

-JJ

--

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


Re: [Matplotlib-users] eps/pdf/svg contourf contours don't overlap properly with high resolution data

2010-05-20 Thread ayuffa

Yes, it's true that uncommenting path.simplify : False line inside the
matplotlibrc file fixes the artifacts.  However, it also produces HUGE
PDF/EPS file sizes.  Perhaps, it's better to change path.simplify parameter
as needed inside the code via:

import matplotlib.pyplot as plt
plt.rcParams['path.simplify'] = False
# Plotting Code Block goes here
plt.rcdefaults()

Does anyone have another fix for this problem that DOES NOT produce HUGE
PDF/EPS files?


efiring wrote:
 
 Jouni K. Seppänen wrote:
 Jordan Dawe jd...@eos.ubc.ca writes:
 
 Contourf plots that I output in vector format files have little
 triangular glitches at the contour boundaries if the contoured array
 is larger than about 200x200. The same files in png format are
 perfect, even at very high dpi values.
 
 The current svn trunk doesn't have the really jarring little triangles
 (at least in the pdf output), but there are still several very obtuse
 white triangles between the regions. Rasterization at a high dpi makes
 the output somewhat better at the cost of larger output files:
 
 c=contourf(X, Y, Z, 10)
 axis((-3, 3, -3, 3))
 savefig('unrasterized.pdf')
 for d in c.collections:
 d.set_rasterized(True)
 savefig('rasterized.pdf',dpi=200)
 
 
 At least in the trunk--and maybe in 0.99.0--the problem is caused by 
 path simplification.  In the trunk, for the eps file, it goes away 
 completely if I use a matplotlibrc with
 
 path.simplify : False
 
 In the trunk, what seems to be happening is that when a contour boundary 
 is almost straight, but has an inflection point, the curves for the 
 adjacent patch boundaries are simplified slightly differently.  This is 
 not surprising; if nothing else, the path will be traveled in a 
 different direction when it is an outer boundary than when it is an 
 inner boundary (for a set of concentric boundaries).
 
 Jordan, try using a local matplotlibrc with the above.  Unless you are 
 already customizing via a local matplotlibrc, that line is all you need.
 
 One reason the trunk behavior differs from 0.99.0 is that contour patch 
 boundaries are now being turned into compound boundaries instead of 
 using a branch cut to connect the outside path to the inside path.  I 
 suspect simplification is causing the artifacts in both cases, though.
 
 Eric
 
 
 --
 This SF.Net email is sponsored by the Verizon Developer Community
 Take advantage of Verizon's best-in-class app development support
 A streamlined, 14 day to market process makes app distribution fast and
 easy
 Join now and get one step closer to millions of Verizon customers
 http://p.sf.net/sfu/verizon-dev2dev 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 

-- 
View this message in context: 
http://old.nabble.com/eps-pdf-svg-contourf-contours-don%27t-overlap-properly-with-high-resolution-data-tp26982883p28617537.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--

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


Re: [Matplotlib-users] Ordinal must be = 1 with SuplotHost and dates

2010-05-20 Thread Solomon M Negusse

Hello, 
I came across  problem of label rotation with autofmt_xdate() in subplothost
too. Is there a new version with the bug fixed or a workaround to doing the
label rotation in subplothost? 
Thanks,
Solomon

Jae-Joon Lee wrote:
 
 The workarounds suggested in this thread does not work?
 To me, the ordinal thing is not actually a bug,  but you need some
 extra caution to avoid this error happening.
 
 The issue with the label roration is a different matter though.
 
 Regards,
 
 -JJ
 
 
 On Wed, Jan 13, 2010 at 8:16 AM, Rodribat rodri...@gmail.com wrote:


 Hi matplotlib users!

 Did someone solve the problem of use fig.autofmt_xdate() function with
 SubplotHost object?
 I googled for it and I found this question only here, without solution.
 Is
 there a bug? Anyone knows
 someway to solve this?

 Thank you,

 []'s

 Rodrigo Batista


 David GUERINEAU wrote:

 Hi matplotlib_users !

 I'm David from Berlin, and believe I'm experiencing some problem with
 the
 SubplotHost module:

 I'm generating graphs from hudge databases of cpu and ethernet
 statistics,
 and I wanted to mix several graphs concerning ethernet statistics in the
 same figure,
 with time as x axis, and bytes-in, bytes-out, packets-in, packets-out
 and
 number of
 collisions as three different y axes, with three different scale.

 I took the inspiration from

 for the x axes and from

 http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html
 for the y axes

 The following code is a synthetic reproduction of the problem I'm
 experiencing (it is also attached):

 from matplotlib.dates import date2num
 from matplotlib import pyplot
 from matplotlib import pylab
 from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
 from datetime import datetime

 dates = [ 733581.2083337, 733581.20837962965, 733581.20842592593,
 733581.2084721, 733581.20851851848,
       733581.20855324075, 733581.20858796302, 733581.2086342593,
 733581.20866898145, 733581.20871527772]
 rxB = [054L, 130L, 144L, 54L, 36L, 9L, 35L, 43L, 85L, 43L]
 txB = [4L, 9L, 9L, 5L, 4L, 4L, 4L, 5L, 6L, 5L]
 rxP = [77, 228, 251, 112, 77, 42, 75, 97, 147, 91]
 txP = [61, 177, 188, 90, 61, 40, 64, 76, 113, 77]
 col = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]

 ethPlot = pyplot
 fig = ethPlot.figure()
 host = SubplotHost(fig, 111)

 host.set_ylabel(kB/s)
 host.set_xlabel(Time)

 par1 = host.twinx()
 par2 = host.twinx()

 par1.set_ylabel(Packets/s)

 par2.axis[right].set_visible(False)

 offset = 60, 0
 new_axisline = par2.get_grid_helper().new_fixed_axis
 par2.axis[right2] = new_axisline(loc=right,
                     axes=par2,
                     offset=offset)

 par2.axis[right2].label.set_visible(True)
 par2.axis[right2].set_label(Collisions)

 par1.set_ylim(0, 6000)
 par2.set_ylim(0, 7000)

 host.axis([ dates[0], ( dates[0] + 0.041  ), -7000, 7000])
 par1.axis([ dates[0], ( dates[0] + 0.041  ), -1, 1])
 par2.axis([ dates[0], ( dates[0] + 0.041  ), -700, 700])

 fig.add_axes(host)
 ethPlot.subplots_adjust(right=0.75)

 drawRxByt, = host.plot_date(dates, rxB, 'g', tz=None, xdate=True,
 ydate=False, label=kB/s in)
 drawTxByt, = host.plot_date(dates, txB, 'b', tz=None, xdate=True,
 ydate=False, label=kB/s out)
 drawRxPaq, = par1.plot_date(dates, rxP, 'm', tz=None, xdate=True,
 ydate=False, label=packets/s in)
 drawTxPaq, = par1.plot_date(dates, txP, 'y', tz=None, xdate=True,
 ydate=False, label=packets/s out)
 drawColls, = par2.plot_date(dates, col, 'r', tz=None, xdate=True,
 ydate=False, label=collisions)

 fig.autofmt_xdate()

 host.set_xlabel(Time)
 host.set_ylabel(kB/s)
 par1.set_ylabel(Packets/s)

 host.legend()

 host.axis[left].label.set_color(drawRxByt.get_color())
 host.axis[left].label.set_color(drawTxByt.get_color())
 par1.axis[right].label.set_color(drawRxPaq.get_color())
 par1.axis[right].label.set_color(drawtxPaq.get_color())
 par2.axis[right2].label.set_color(drawColls.get_color())

 ethPlot.draw()
 pylab.savefig( './test.png', dpi=(640/8))




 Maybe I do something wrong somewhere here, but other scripts that do the
 same for a single graphwork like a charm. So it's not a question of
 dataType
 or something. To compare with a working code, here is the first version
 of
 the fuction that does the job on single graphs without any problem :

 def drawEthGraph(filename, hdates, rxP, txP, rxB, txB, col):
   ethPlot = pyplot
   fig = ethPlot.figure()
   ax = fig.add_subplot(111)
   ax.plot_date(hdates, rxP, 'g', None, True, False)
   ax.plot_date(hdates, txP, 'b', None, True, False)
   ax.plot_date(hdates, rxB, 'g', None, True, False)
   ax.plot_date(hdates, txB, 'b', None, True, False)
   ax.plot_date(hdates, col, 'r', None, True, False)
   ax.axis([ hdates[0], ( hdates[0] + 0.042  ), -7000, 7000])
   ax.grid(True)
   fig.autofmt_xdate()
   pylab.savefig( filename, dpi=(640/8))


 I don't think I understand the whole process of generation, but I
 thought
 at
 least at the beginnig I was having a good feeling with this API.
 Now I wonder how to go 

Re: [Matplotlib-users] LaTeX error on semilogy + usetex + SubplotHost

2010-05-20 Thread João Luís Silva
Jae-Joon Lee wrote:
 I cannot reproduce this error.
 I'm using r8330 on Linux.
 
 I guess the error does not occur when you use a normal subplot?
 
 Just in case, replace axes_grid with axes_grid1 and see if it makes
 any difference, i.e.,
 
 from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost
 
 Regards,
 
 -JJ
 

I've tried axes_grid1 and it works well. I'm using the default latex 
(Ubuntu 9.10)

latex --version
pdfTeX using libpoppler 3.141592-1.40.3-2.2 (Web2C 7.5.6)
[etc.]

Both the patches presented fixed the problem, thanks.

João Silva


--

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