Re: [Matplotlib-users] Unused matplotlibrc parameter

2009-06-17 Thread Paul Novak
Pardon me, but I was hasty in sending the diff. The following diff will 
put a multiplication symbol in the tick label where large numbers are 
expected, but it also removes any possibility of getting a number 
written as 1e10, for example, so it definitely is not complete. 
Hopefully, this is a starting point for someone else to fix this properly.

Thanks,
Paul

Index: lib/matplotlib/ticker.py
===
--- lib/matplotlib/ticker.py(revision 7225)
+++ lib/matplotlib/ticker.py(working copy)
@@ -384,18 +384,10 @@
  offsetStr = self.format_data(self.offset)
  if self.offset > 0: offsetStr = '+' + offsetStr
  if self.orderOfMagnitude:
-if self._usetex or self._useMathText:
-sciNotStr = self.format_data(10**self.orderOfMagnitude)
-else:
-sciNotStr = '1e%d'% self.orderOfMagnitude
-if self._useMathText:
-if sciNotStr != '':
-sciNotStr = r'\times\mathdefault{%s}' % sciNotStr
+sciNotStr = self.format_data(10**self.orderOfMagnitude)
+if sciNotStr != '':
+sciNotStr = r'\times\mathdefault{%s}' % sciNotStr
  s = 
''.join(('$',sciNotStr,r'\mathdefault{',offsetStr,'}$'))
-elif self._usetex:
-if sciNotStr != '':
-sciNotStr = r'\times%s' % sciNotStr
-s =  ''.join(('$',sciNotStr,offsetStr,'$'))
  else:
  s =  ''.join((sciNotStr,offsetStr))

@@ -476,19 +468,15 @@
  significand = tup[0].rstrip('0').rstrip('.')
  sign = tup[1][0].replace('+', '')
  exponent = tup[1][1:].lstrip('0')
-if self._useMathText or self._usetex:
-if significand == '1':
-# reformat 1x10^y as 10^y
-significand = ''
-if exponent:
-exponent = '10^{%s%s}'%(sign, exponent)
-if significand and exponent:
-return r'%s{\times}%s'%(significand, exponent)
-else:
-return r'%s%s'%(significand, exponent)
+if significand == '1':
+# reformat 1x10^y as 10^y
+significand = ''
+if exponent:
+exponent = '10^{%s%s}'%(sign, exponent)
+if significand and exponent:
+return r'%s{\times}%s'%(significand, exponent)
  else:
-s = ('%se%s%s' %(significand, sign, exponent)).rstrip('e')
-return s
+return r'%s%s'%(significand, exponent)
  except IndexError, msg:
  return s

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Unused matplotlibrc parameter

2009-06-17 Thread Paul Novak
Hello,

I think there is an unused parameter in matplotlibrc, the text.markup 
which defaults to 'plain'. text.markup is not found in rcsetup.py.

Similarly, there is a keyword to ScalarFormatter, useMathText, that is 
always set to its default, False, in ticker.py; no other function 
accesses or uses that keyword. It seems that could be eliminated without 
ill-effect.

I came across this while looking for a way to have the tick formatter 
include a multiplication sign when writing very large numbers, instead 
of using engineering notation such as 1e10. I would like to be able to 
do this using the mathtext facilities native to matplotlib, and not have 
to resort to usetex.

The following diff changes the tick formatter to work as I would like 
it, but it also probably breaks something else because I have not tested 
it at all. Please consider it as a starting point.

Paul

Index: ticker.py
===
--- ticker.py   (revision 7225)
+++ ticker.py   (working copy)
@@ -384,18 +384,10 @@
  offsetStr = self.format_data(self.offset)
  if self.offset > 0: offsetStr = '+' + offsetStr
  if self.orderOfMagnitude:
-if self._usetex or self._useMathText:
-sciNotStr = self.format_data(10**self.orderOfMagnitude)
-else:
-sciNotStr = '1e%d'% self.orderOfMagnitude
-if self._useMathText:
-if sciNotStr != '':
-sciNotStr = r'\times\mathdefault{%s}' % sciNotStr
+sciNotStr = self.format_data(10**self.orderOfMagnitude)
+if sciNotStr != '':
+sciNotStr = r'\times\mathdefault{%s}' % sciNotStr
  s = 
''.join(('$',sciNotStr,r'\mathdefault{',offsetStr,'}$'))
-elif self._usetex:
-if sciNotStr != '':
-sciNotStr = r'\times%s' % sciNotStr
-s =  ''.join(('$',sciNotStr,offsetStr,'$'))
  else:
  s =  ''.join((sciNotStr,offsetStr))

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hexbin extent Attribute Error

2009-06-17 Thread John Hunter
On Wed, Jun 17, 2009 at 5:31 PM, Alexandar Hansen wrote:
> Hello,
>
> I've been having fun using hexbin, but I'd like to have consistent bin sizes
> and plot ranges for different sets of data. What I'm finding is that the bin
> sizes are primarily determined by the input data mins and maxes. For
> instance, I'm plotting data with something like:

Instead of a "something like" could you please post a complete example
that we can run so we can replicate the error.  This saves us a lot of
time.  Also, please report any version info, as described at

http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-problem

For example, the following runs for me using mpl svn:

import numpy as np
import matplotlib.cm as cm
import  matplotlib.pyplot as plt

n = 10
x = np.random.standard_normal(n)
y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n)
xmin = x.min()
xmax = x.max()
ymin = y.min()
ymax = y.max()

plt.subplots_adjust(hspace=0.5)
plt.subplot(121)
plt.hexbin(x,y, cmap=cm.jet, extent=[xmin, xmax, ymin, ymax])
plt.axis([xmin, xmax, ymin, ymax])
plt.title("Hexagon binning")
cb = plt.colorbar()
cb.set_label('counts')

plt.subplot(122)
plt.hexbin(x,y,bins='log', cmap=cm.jet)
plt.axis([xmin, xmax, ymin, ymax])
plt.title("With a log color scale")
cb = plt.colorbar()
cb.set_label('log10(N)')

plt.show()

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Updating tick labels when using animation

2009-06-17 Thread John Hunter
On Wed, Jun 17, 2009 at 5:27 PM, Elan Pavlov wrote:
> Hi,
> I'm using an animated graph in which most of the time I don't want it
> to autoscale (due to speed). Once in a while I want it to change the
> limits of the y-axis. In order to do this I use set_ylim and follow by
> a canvas.draw(). However it does not actually redraw the canvas and
> the old tick labels remain (although the scales are reset). When I
> manually resize the canvas in updates the tick labels. Any ideas what
> I'm doing wrong?

This doesn't sound right -- a call to canvas.draw should redraw the
whole canvas cleanly, with the exception of Artists where the animated
property is set.  Can you reduce your code to a free-standing example
that we can run?

JDH

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] hexbin extent Attribute Error

2009-06-17 Thread Alexandar Hansen
Hello,

I've been having fun using hexbin, but I'd like to have consistent bin sizes
and plot ranges for different sets of data. What I'm finding is that the bin
sizes are primarily determined by the input data mins and maxes. For
instance, I'm plotting data with something like:

#  import matplotlib.pyplot as plt

#  plt.hexbin(x,y, cmap=cm.hot, gridsize=(50,50))
#  plt.axis([xmin, xmax, ymin, ymax])
#  plt.title("2D Histogram")
#  cb = plt.colorbar()
#  cb.set_label('counts')

#  plt.show()

where xmin, etc are a fixed range. If my data sets span sizeably different
ranges, then the hexagon sizes come out completely different. I'd like to
avoid increasing the gridsize in one or both dimensions too much as that
would require very large grids in some instances.

I thought my solution to the problems would be to use the extent function in
hexbin but when I try, for instance:

#  plt.hexbin(x,y, cmap=cm.hot, gridsize=(50,50),
extent=[xmin,xmax,ymin,ymax])

I get these strange errors:

  File "HexPlotLog.py", line 64, in 
plt.hexbin(x,y, cmap=cm.hot, gridsize=(50,50), extent=[xmin, xmax, ymin,
ymax])
  File "/usr/lib64/python2.5/site-packages/matplotlib/pyplot.py", line 1920,
in hexbin
ret =  gca().hexbin(*args, **kwargs)
  File "/usr/lib64/python2.5/site-packages/matplotlib/axes.py", line 5447,
in hexbin
collection.update(kwargs)
  File "/usr/lib64/python2.5/site-packages/matplotlib/artist.py", line 548,
in update
raise AttributeError('Unknown property %s'%k)
AttributeError: Unknown property extent


The other thing I'd like to do is to set the background color of the plot to
black, or otherwise the same color as a bin of zero. I imagine this is
something I can find in the manuals, but since I'm asking questions, may as
well include it :)

I appreciate any help that can be offered.

Best,

Alex
--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Updating tick labels when using animation

2009-06-17 Thread Elan Pavlov
Hi,
I'm using an animated graph in which most of the time I don't want it
to autoscale (due to speed). Once in a while I want it to change the
limits of the y-axis. In order to do this I use set_ylim and follow by
a canvas.draw(). However it does not actually redraw the canvas and
the old tick labels remain (although the scales are reset). When I
manually resize the canvas in updates the tick labels. Any ideas what
I'm doing wrong?

Elan
-- 
If I knew that a man was coming to my house with the conscious design
of doing me good, I should run for my life.
- Henry David Thoreau

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Visuals for linux file systems

2009-06-17 Thread Gökhan SEVER
For those who haven't seen the article on slashdot:

A Visual Expedition Inside the Linux File
Systems

Some figures are highly eye-catching. Some of which I haven't seen in
matplotlib gallery nor could be produced with.

Gökhan
--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] drawing a line segment wjhen using polar coordinates

2009-06-17 Thread Yeates, Mathew C
Thanks. The svn trunk worked for me.

-Original Message-
From: Michael Droettboom [mailto:md...@stsci.edu] 
Sent: Wednesday, June 17, 2009 9:27 AM
To: Yeates, Mathew C
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] drawing a line segment wjhen using polar 
coordinates

You can pass "resolution=1" to the axes function.  Unfortunately, when 
doing that you will lose the grid lines.  This is a known bug. 

Better yet, update to SVN trunk which does this by default and has 
working grid lines.

Mike

Yeates, Mathew C wrote:
>
> The following produces an  arc instead of a line. What am I doing wrong?
>
>  
>
> ax = axes(polar=True,rmax=1.0)
>
> polar([1,2],[0.2,0.3])   #or plot([1,2],[0.2,0.3])
>
> 
>
> --
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing 
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> 
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] drawing a line segment wjhen using polar coordinates

2009-06-17 Thread Michael Droettboom
You can pass "resolution=1" to the axes function.  Unfortunately, when 
doing that you will lose the grid lines.  This is a known bug. 

Better yet, update to SVN trunk which does this by default and has 
working grid lines.

Mike

Yeates, Mathew C wrote:
>
> The following produces an  arc instead of a line. What am I doing wrong?
>
>  
>
> ax = axes(polar=True,rmax=1.0)
>
> polar([1,2],[0.2,0.3])   #or plot([1,2],[0.2,0.3])
>
> 
>
> --
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing 
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> 
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] drawing a line segment wjhen using polar coordinates

2009-06-17 Thread Yeates, Mathew C
The following produces an  arc instead of a line. What am I doing wrong?

ax = axes(polar=True,rmax=1.0)
polar([1,2],[0.2,0.3])   #or plot([1,2],[0.2,0.3])
--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] beginner help: color map plot from raw data

2009-06-17 Thread Matthias Michler
On Tuesday 16 June 2009 21:29:29 Nathaniel Echols wrote:
> I'm attempting to plot the distribution of bond angles in protein
> structures (the best-known example:
> http://en.wikipedia.org/wiki/Ramachandran_plot).  I have the raw data as a
> collection of x,y,z data, where x and y are integers between -180 and 180,
> and z is a floating-point value.  (Right now, this data is pure Python
> objects, but I can convert it to NumPy arrays if that would be easier.)  I
> would like to plot this as a continuous color map inside a wxPython window,
> and also overlay the discreet data points for a separate protein.  It
> doesn't really matter what combination of colors I use for this - there
> appear to be many built-in color maps that would be suitable.  I'm pretty
> sure this is possible, based on looking at the examples, but I have no clue
> how to go about this - it doesn't help that all of the examples appear to
> use the pylab interface.  Any suggestions? thanks,
> Nat

Hi Nat

For embedding matplotlib in wx you can have a look at the examples 
embedding_in_wx*.py on 
http://matplotlib.sourceforge.net/examples/user_interfaces/ .

Furthermore you can have a look a the screenshots/examples of imshow and 
contourf for the background and plot / scatter for the discrete data points. 
These functions are included in pylab and also available as methods of an 
axes instance, e.g.
self.axes = self.figure.add_subplot(111)
self.axes.contourf(X, Y, Z)
# and
self.axes.plot(x, y)

best regards Matthias

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users