Re: [Matplotlib-users] Getting arrax indices using the zoom tool

2009-04-17 Thread Matthias Michler
Hi Gökhan,

I recommend you to use matplotlib.widgets.RectangleSelector instead of the 
zoom functionality to select the data (An example can be found at 
http://matplotlib.sourceforge.net/examples/widgets/rectangle_selector.html ).
This will return you the x and y-coordinate of button press and button release 
event and with that you can take a portion of your data.
Something like the following could be a starting point:
x_min = min(eclick.xdata, erelease.xdata)
x_max = max(eclick.xdata, erelease.xdata)
x_new = x[(x= x_min)  (x = x_max)]

where eclick and erelease correspond to the click and release event of the 
rectangle selection (see the example below).

Opening a new figure after show can be achieved by:

fig_new = plt.figure()
# some plotting
fig_new.show() # show up the new figure


best regards Matthias


yet another example for the usage of the RectangleSelector copied from its 
class documentation:


Select a min/max range of the x axes for a matplotlib Axes

Example usage::

from matplotlib.widgets import  RectangleSelector
from pylab import *

def onselect(eclick, erelease):
  'eclick and erelease are matplotlib events at press and release'
  print ' startposition : (%f, %f)' % (eclick.xdata, eclick.ydata)
  print ' endposition   : (%f, %f)' % (erelease.xdata, erelease.ydata)
  print ' used button   : ', eclick.button

def toggle_selector(event):
print ' Key pressed.'
if event.key in ['Q', 'q'] and toggle_selector.RS.active:
print ' RectangleSelector deactivated.'
toggle_selector.RS.set_active(False)
if event.key in ['A', 'a'] and not toggle_selector.RS.active:
print ' RectangleSelector activated.'
toggle_selector.RS.set_active(True)

x = arange(100)/(99.0)
y = sin(x)
fig = figure
ax = subplot(111)
ax.plot(x,y)

toggle_selector.RS = RectangleSelector(ax, onselect, drawtype='line')
connect('key_press_event', toggle_selector)
show()


On Friday 17 April 2009 02:26:51 Gökhan SEVER wrote:
 Hello,

 A quick question:

 I am using two numpy arrays to plot the figure shown in attachment. Is it
 possible to get array indices of selected X-axes while using the zoom
 function? Later I can create a new figure from this selected portion
 instead of the same figure and/or apply an analysis.

 Thank you.

--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] imshow: large eps-files

2009-04-17 Thread Peter Pippan
Hi,

I was wondering about the eps output produced by imshow().

This program
--
from pylab import *
Z = rand(10,10)
imshow(Z,interpolation='nearest',cmap=cm.bone)
savefig('bone.eps')
imshow(Z,interpolation='nearest',cmap=cm.gray)
savefig('gray.eps')
--
produces files with sizes of
11M and 172K for bone.eps and gray.eps
respectively.

Does anybody know why the difference is that large?
I would expect a factor of 3 for RGB or 4 if an alpha channel is
included, but not a factor of about 60.

Best regards,
Peter

--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] GEOS Error

2009-04-17 Thread John [H2O]

Does anyone know what this error may result from:
GEOS_ERROR: TopologyException: no outgoing dirEdge found (74.5584,-90,-90)
Segmentation fault


I am getting it for various projections and datasets...

working with mpl_toolkits.basemap

Thanks!
-- 
View this message in context: 
http://www.nabble.com/GEOS-Error-tp23096254p23096254.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Memory leak in Agg backend?

2009-04-17 Thread Andres Luhamaa
Michael Droettboom wrote:
 I am not able to reproduce this leak here with 0.98.6svn from today on 
 RHEL4.  What platform are you on?

 (See attached massif profile -- the memory usage is flat...)

 Mike
Well, in my setup I see similar behaviour as in the initial question. 
Ubuntu 8.10 32bit, 2-days old svn verion of matplotlib.

Andres

 Jesper Larsen wrote:
 Hi matplotlib developers and users,

 I have had some problems with a memory leak in a long running
 matplotlib based web application that I have developed
 (www.worldwildweather.com). I believe the problem is due to a memory
 leak in the Agg backend but I am not sure. Below is a script which for
 me results in a consistently increasing amount of  memory usage. I am
 using mpl version 0.98.6svn. The problem does not occur when the
 savefig command is commented out. And it does not occur when cs =
 ax.contourf(z) and ax.cla() are moved outside the loop (before and
 after respectively).

 Best regards,
 Jesper

 import os, gc
 import numpy as npy
 import matplotlib as mpl
 from matplotlib.figure import Figure
 from matplotlib.backends.backend_agg import FigureCanvasAgg as 
 FigureCanvas

 def report_memory():
 Report memory.
 gc.collect()
 pid = os.getpid()
 a2 = os.popen('ps -p %d -o rss,vsz,%%mem' % pid).readlines()
 return int(a2[1].split()[1])

 fig = Figure(dpi=100)
 ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
 FigureCanvas(fig)

 n = 1000
 z = npy.zeros((n,n))
 for i in range(2000):
 cs = ax.contourf(z)
 fig.savefig('test.png')
 ax.cla()
 print report_memory(), i

 I have not pasted in all of the output but just the first and last 25 
 lines:
 53356 0
 53360 1
 53360 2
 53360 3
 53360 4
 53360 5
 53360 6
 53360 7
 53360 8
 53360 9
 53360 10
 53360 11
 53360 12
 53360 13
 53360 14
 53360 15
 53360 16
 53360 17
 53356 18
 53360 19
 53360 20
 53360 21
 53360 22
 53360 23
 53356 24
 ...
 57552 1975
 57552 1976
 57552 1977
 57552 1978
 57552 1979
 57552 1980
 57552 1981
 57552 1982
 57552 1983
 57552 1984
 57552 1985
 57552 1986
 57552 1987
 57552 1988
 57552 1989
 57552 1990
 57552 1991
 57552 1992
 57552 1993
 57552 1994
 57552 1995
 57552 1996
 57552 1997
 57552 1998
 57552 1999

 --
  

 This SF.net email is sponsored by:
 High Quality Requirements in a Collaborative Environment.
 Download a free trial of Rational Requirements Composer Now!
 http://p.sf.net/sfu/www-ibm-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   

 

 --
 This SF.net email is sponsored by:
 High Quality Requirements in a Collaborative Environment.
 Download a free trial of Rational Requirements Composer Now!
 http://p.sf.net/sfu/www-ibm-com
 

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


--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Memory leak in Agg backend?

2009-04-17 Thread Michael Droettboom
Are you able to run it inside of valgrind's massif tool?  Calling out to 
ps can be a bit spurious (particularly with a memory-pooling Python 
build) especially for a leak this small.

Mike

Andres Luhamaa wrote:
 Michael Droettboom wrote:
   
 I am not able to reproduce this leak here with 0.98.6svn from today on 
 RHEL4.  What platform are you on?

 (See attached massif profile -- the memory usage is flat...)

 Mike
 
 Well, in my setup I see similar behaviour as in the initial question. 
 Ubuntu 8.10 32bit, 2-days old svn verion of matplotlib.

 Andres
   
 Jesper Larsen wrote:
 
 Hi matplotlib developers and users,

 I have had some problems with a memory leak in a long running
 matplotlib based web application that I have developed
 (www.worldwildweather.com). I believe the problem is due to a memory
 leak in the Agg backend but I am not sure. Below is a script which for
 me results in a consistently increasing amount of  memory usage. I am
 using mpl version 0.98.6svn. The problem does not occur when the
 savefig command is commented out. And it does not occur when cs =
 ax.contourf(z) and ax.cla() are moved outside the loop (before and
 after respectively).

 Best regards,
 Jesper

 import os, gc
 import numpy as npy
 import matplotlib as mpl
 from matplotlib.figure import Figure
 from matplotlib.backends.backend_agg import FigureCanvasAgg as 
 FigureCanvas

 def report_memory():
 Report memory.
 gc.collect()
 pid = os.getpid()
 a2 = os.popen('ps -p %d -o rss,vsz,%%mem' % pid).readlines()
 return int(a2[1].split()[1])

 fig = Figure(dpi=100)
 ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
 FigureCanvas(fig)

 n = 1000
 z = npy.zeros((n,n))
 for i in range(2000):
 cs = ax.contourf(z)
 fig.savefig('test.png')
 ax.cla()
 print report_memory(), i

 I have not pasted in all of the output but just the first and last 25 
 lines:
 53356 0
 53360 1
 53360 2
 53360 3
 53360 4
 53360 5
 53360 6
 53360 7
 53360 8
 53360 9
 53360 10
 53360 11
 53360 12
 53360 13
 53360 14
 53360 15
 53360 16
 53360 17
 53356 18
 53360 19
 53360 20
 53360 21
 53360 22
 53360 23
 53356 24
 ...
 57552 1975
 57552 1976
 57552 1977
 57552 1978
 57552 1979
 57552 1980
 57552 1981
 57552 1982
 57552 1983
 57552 1984
 57552 1985
 57552 1986
 57552 1987
 57552 1988
 57552 1989
 57552 1990
 57552 1991
 57552 1992
 57552 1993
 57552 1994
 57552 1995
 57552 1996
 57552 1997
 57552 1998
 57552 1999

 --
  

 This SF.net email is sponsored by:
 High Quality Requirements in a Collaborative Environment.
 Download a free trial of Rational Requirements Composer Now!
 http://p.sf.net/sfu/www-ibm-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   
   
 

 --
 This SF.net email is sponsored by:
 High Quality Requirements in a Collaborative Environment.
 Download a free trial of Rational Requirements Composer Now!
 http://p.sf.net/sfu/www-ibm-com
 

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


 --
 Stay on top of everything new and different, both inside and 
 around Java (TM) technology - register by April 22, and save
 $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
 300 plus technical and hands-on sessions. Register today. 
 Use priority code J9JMT32. http://p.sf.net/sfu/p
 ___
 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


--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] EPS rasterizing - a solution (and a question)

2009-04-17 Thread Thomas Robitaille
Hi,

A while ago, I sent an email around asking about the EPS output from  
matplotlib. The following example summarizes the problem well:

import matplotlib
matplotlib.use('Agg')
from matplotlib.pyplot import *

import numpy as np

nx,ny = 10,10

image = np.random.random((nx,ny))

fig = figure(figsize=(4,4))
ax = fig.add_subplot(111)
ax.pcolorfast(image)
fig.savefig('plot.eps')
fig.savefig('plot.pdf')
fig.savefig('plot.svg')

This produces files with the following sizes:

600Kplot.eps
8.0Kplot.pdf
20K plot.svg

The EPS file is much larger because the bitmap is being rasterized to  
a much higher resolution than a 10x10 grid. However, I eventually  
figured out that the best way to solve this, assuming that the pixels  
are square, and that the pixels line up with the axes is:

fig = figure(figsize=(4,4))
ax = fig.add_subplot(111,aspect='equal')
ax.imshow(image)
width = ax.get_position().width * 4
dpi = nx / width
fig.savefig('plot2.eps',dpi=dpi)

which produces

12K plot2.eps

As a temporary solution this works well - essentially matching the DPI  
to the resolution of the input array.

However, I have one remaining problem. In plot2.eps, the frame border  
has disappeared. Is this a bug? Does anyone know why this might be  
happening?

Thanks for any advice,

Thomas

--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] GEOS Error

2009-04-17 Thread Jeff Whitaker
John [H2O] wrote:
 Does anyone know what this error may result from:
 GEOS_ERROR: TopologyException: no outgoing dirEdge found (74.5584,-90,-90)
 Segmentation fault


 I am getting it for various projections and datasets...

 working with mpl_toolkits.basemap

 Thanks!
   
What versions of python, numpy, matplotlib, basemap and the GEOS library 
do you have?

-Jeff

-- 
Jeffrey S. Whitaker Phone  : (303)497-6313
Meteorologist   FAX: (303)497-6449
NOAA/OAR/PSD  R/PSD1Email  : jeffrey.s.whita...@noaa.gov
325 BroadwayOffice : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg


--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Getting arrax indices using the zoom tool

2009-04-17 Thread Gökhan SEVER
Thanks for the pointer Matthias,

That is exactly what I have been looking for.

I use the code from the RectangleSelector class help with your suggested
code. I know that I have to update y-axis accordingly to x values such that
their positions and sizes must much so that I can plot them in a new plot.
And I know that the answer lies in a mask; I have to create a mask from
x_new and apply it to y. Do you have any hint on this?

Another point is do you have any idea how to save values from inside
onselect action?

For some reason my ipython session doesn't remember values after I run the
given script:


from matplotlib.widgets import  RectangleSelector
from pylab import *

def onselect(eclick, erelease):
 # eclick and erelease are matplotlib events at press and release
print ' startposition : (%f, %f)' % (eclick.xdata, eclick.ydata)
print ' endposition   : (%f, %f)' % (erelease.xdata, erelease.ydata)
print ' used button   : ', eclick.button
xmin = min(eclick.xdata, erelease.xdata)
xmax = max(eclick.xdata, erelease.xdata)
ymin = min(eclick.ydata, erelease.ydata)
ymax = max(eclick.ydata, erelease.ydata)
x_new = x[(x= xmin)  (x = xmax)]
#mask = [x == x_new[i] for i in range(len(x_new))]
#print mask
#print len(x_new)
#print len(y_new)
#fig_new = figure()
#plot(x_new, y_new)
#fig_new.show()

def toggle_selector(event):
print ' Key pressed.'
if event.key in ['Q', 'q'] and toggle_selector.RS.active:
print ' RectangleSelector deactivated.'
toggle_selector.RS.set_active(False)
if event.key in ['A', 'a'] and not toggle_selector.RS.active:
print ' RectangleSelector activated.'
toggle_selector.RS.set_active(True)

x = arange(100)/(99.0)
y = sin(x)
fig = figure
ax = subplot(111)
ax.plot(x,y)

toggle_selector.RS = RectangleSelector(ax, onselect, drawtype='box')
connect('key_press_event', toggle_selector)
show()

Gökhan


On Fri, Apr 17, 2009 at 2:31 AM, Matthias Michler
matthiasmich...@gmx.netwrote:

 Hi Gökhan,

 I recommend you to use matplotlib.widgets.RectangleSelector instead of the
 zoom functionality to select the data (An example can be found at
 http://matplotlib.sourceforge.net/examples/widgets/rectangle_selector.html).
 This will return you the x and y-coordinate of button press and button
 release
 event and with that you can take a portion of your data.
 Something like the following could be a starting point:
 x_min = min(eclick.xdata, erelease.xdata)
 x_max = max(eclick.xdata, erelease.xdata)
 x_new = x[(x= x_min)  (x = x_max)]

 where eclick and erelease correspond to the click and release event of the
 rectangle selection (see the example below).

 Opening a new figure after show can be achieved by:

 fig_new = plt.figure()
 # some plotting
 fig_new.show() # show up the new figure


 best regards Matthias


 yet another example for the usage of the RectangleSelector copied from its
 class documentation:


Select a min/max range of the x axes for a matplotlib Axes

Example usage::

from matplotlib.widgets import  RectangleSelector
from pylab import *

def onselect(eclick, erelease):
  'eclick and erelease are matplotlib events at press and release'
  print ' startposition : (%f, %f)' % (eclick.xdata, eclick.ydata)
  print ' endposition   : (%f, %f)' % (erelease.xdata,
 erelease.ydata)
  print ' used button   : ', eclick.button

def toggle_selector(event):
print ' Key pressed.'
if event.key in ['Q', 'q'] and toggle_selector.RS.active:
print ' RectangleSelector deactivated.'
toggle_selector.RS.set_active(False)
if event.key in ['A', 'a'] and not toggle_selector.RS.active:
print ' RectangleSelector activated.'
toggle_selector.RS.set_active(True)

x = arange(100)/(99.0)
y = sin(x)
fig = figure
ax = subplot(111)
ax.plot(x,y)

toggle_selector.RS = RectangleSelector(ax, onselect,
 drawtype='line')
connect('key_press_event', toggle_selector)
show()
 

 On Friday 17 April 2009 02:26:51 Gökhan SEVER wrote:
  Hello,
 
  A quick question:
 
  I am using two numpy arrays to plot the figure shown in attachment. Is it
  possible to get array indices of selected X-axes while using the zoom
  function? Later I can create a new figure from this selected portion
  instead of the same figure and/or apply an analysis.
 
  Thank you.


 --
 Stay on top of everything new and different, both inside and
 around Java (TM) technology - register by April 22, and save
 $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
 300 plus technical and hands-on sessions. Register today.
 Use priority code J9JMT32. http://p.sf.net/sfu/p
 ___
 

Re: [Matplotlib-users] Memory leak in Agg backend?

2009-04-17 Thread Andres Luhamaa
Well, I have never used it before but here is the output from valgrind 
masstif, can you figure out something from this? The mem usage from 
python was still increasing.


Andres

Michael Droettboom wrote:
Are you able to run it inside of valgrind's massif tool?  Calling out 
to ps can be a bit spurious (particularly with a memory-pooling Python 
build) especially for a leak this small.


Mike

Andres Luhamaa wrote:

Michael Droettboom wrote:
 
I am not able to reproduce this leak here with 0.98.6svn from today 
on RHEL4.  What platform are you on?


(See attached massif profile -- the memory usage is flat...)

Mike

Well, in my setup I see similar behaviour as in the initial question. 
Ubuntu 8.10 32bit, 2-days old svn verion of matplotlib.


Andres
 

Jesper Larsen wrote:
   

Hi matplotlib developers and users,

I have had some problems with a memory leak in a long running
matplotlib based web application that I have developed
(www.worldwildweather.com). I believe the problem is due to a memory
leak in the Agg backend but I am not sure. Below is a script which for
me results in a consistently increasing amount of  memory usage. I am
using mpl version 0.98.6svn. The problem does not occur when the
savefig command is commented out. And it does not occur when cs =
ax.contourf(z) and ax.cla() are moved outside the loop (before and
after respectively).

Best regards,
Jesper

import os, gc
import numpy as npy
import matplotlib as mpl
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg as 
FigureCanvas


def report_memory():
Report memory.
gc.collect()
pid = os.getpid()
a2 = os.popen('ps -p %d -o rss,vsz,%%mem' % pid).readlines()
return int(a2[1].split()[1])

fig = Figure(dpi=100)
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
FigureCanvas(fig)

n = 1000
z = npy.zeros((n,n))
for i in range(2000):
cs = ax.contourf(z)
fig.savefig('test.png')
ax.cla()
print report_memory(), i

I have not pasted in all of the output but just the first and last 
25 lines:

53356 0
53360 1
53360 2
53360 3
53360 4
53360 5
53360 6
53360 7
53360 8
53360 9
53360 10
53360 11
53360 12
53360 13
53360 14
53360 15
53360 16
53360 17
53356 18
53360 19
53360 20
53360 21
53360 22
53360 23
53356 24
...
57552 1975
57552 1976
57552 1977
57552 1978
57552 1979
57552 1980
57552 1981
57552 1982
57552 1983
57552 1984
57552 1985
57552 1986
57552 1987
57552 1988
57552 1989
57552 1990
57552 1991
57552 1992
57552 1993
57552 1994
57552 1995
57552 1996
57552 1997
57552 1998
57552 1999

-- 


This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

 



-- 


This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
 



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



-- 

Stay on top of everything new and different, both inside and around 
Java (TM) technology - register by April 22, and save

$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. Use 
priority code J9JMT32. http://p.sf.net/sfu/p

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






massif.out.25331.gz
Description: GNU Zip compressed data
--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] New user having much trouble with formating dates on x-axis

2009-04-17 Thread Sandro Tosi
On Sat, Apr 18, 2009 at 00:22, Andrew Romero romero...@yahoo.com wrote:
 The script plottest.py.txt reads the data file (out.txt) and creates the plot 
 (myfig.png); however,
 I am unable to format the dates ... they always print as floats .. help

are those unix timestamps (from 1970-01-01)?

In any case, you have to convert those in datetime objects, then

dates = list of datetime objects
mpl_dates = [matplotlib.dates.date2num(date) for date in dates]

and at the and use plot_date() instead of plot(), using mpl_dates for X axis.

Regards,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users