[Matplotlib-users] basic understanding of plotting dates

2007-09-03 Thread C M
This is really basic stuff but I had some problems navigating in the
matplotlib website (*if anyone is interested, I'll list those issues at the
end).  I want to simply plot dates.  After reading the tutorial, I just
don't understand how to do it.

I will have lists of dates in the format like 2007-09-01 12:00:02 and a list
of corresponding values.  I would like to make a simple line graph with
markers at the data points and axis markers at reasonable intervals such as
each day or each week.  My questions are:

1. What exactly must I import (which modules) and how do I import them (in
the sense of "import x" vs. "from x import y")?
2. What arguments does the plot_date() command take and what is format of
the arguments?
3. Do I have to make the conversion from the date format above to the
matplotlib date format?  If so, how?

As an example how would I make a line plot with markers for this data?:

x = (2007-09-01 12:00:02, 2007-09-02 12:00:02, 2007-09-03 12:00:02)
y = (10, 20, 30)

Thanks.


*the issues I had with navigating or figuring this out on my own:

Broken links on two of the functions:
http://matplotlib.sourceforge.net/datetime.html
http://matplotlib.sourceforge.net/dateutil.html

In the tutorial, under the dates section, the drange command is used but it
isn't clear which module has to be imported for it to work.  I tried it with
matplotlib and Python's datetime module and it didn't work.

In the date_demo1.py and dat_demo2 in the examples, date is gotten from the
quotes_historical_yahoo module calling up Yahoo's stock quotes.  The problem
for me was I wasn't sure which format the arguments were in that this
quotes_historical_yahoo() returns.
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] inverted x-axis

2007-09-03 Thread Jouni K . Seppänen
Johann Cohen-Tanugi <[EMAIL PROTECTED]> writes:

> I would like to know if there is an easy to invert a axis (specifically 
> the x-axis), id est to have the labels between say 0 an1 automatically 
> run from right to left.

setp(gca(), 'xlim', reversed(getp(gca(), 'xlim')))

i.e., just put the larger limit before the smaller one.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] inverted x-axis

2007-09-03 Thread Johann Cohen-Tanugi
hello,
I would like to know if there is an easy to invert a axis (specifically 
the x-axis), id est to have the labels between say 0 an1 automatically 
run from right to left. This is particularly welcome in astrophysical 
context, where the spherical x coordinate of a 2D image is often reversed.
thanks,
Johann

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Saving just a colorbar

2007-09-03 Thread Eric Firing

Jose,

Attached is an example that should at least point you in the right 
direction.  I will also add it to the examples directory in the 
distribution.


Eric


Jose Gomez-Dans wrote:

Hi,
I am using Matplotlib to produce colormaps which I use with other
programs. I would like to produce a PNG file with the used colormap
(so that I can overlay). Rather than doing an imshow()
followed by colorbar, is there an easy way I could pass the colorbar
my cmap instance to have it plotted on its own? In essence, what I
want to do is to do a savefig, and get something along the lines of
what is shown here: . I will
need to change the scale (i.e.,, the numbers :D) with each run.

So far, I have "cut+pasted" from a whole image, which is hardly convenient! :(

Cheers,
Jose
'''
Make a colorbar as a separate figure.
'''

import pylab
import matplotlib as mpl

# Make a figure and axes with dimensions as desired.
fig = pylab.figure(figsize=(8,1.5))
ax = fig.add_axes([0.05, 0.4, 0.9, 0.5])

# Set the colormap and norm to correspond to the data for which
# the colorbar will be used.
cmap = mpl.cm.cool
norm = mpl.colors.Normalize(vmin=5, vmax=10)

# ColorbarBase derives from ScalarMappable and puts a colorbar
# in a specified axes, so it has everything needed for a
# standalone colorbar.  There are many more kwargs, but the
# following gives a basic continuous colorbar with ticks
# and labels.
cb = mpl.colorbar.ColorbarBase(ax, cmap=cmap,
   norm=norm,
   orientation='horizontal')
cb.set_label('Some Units')

pylab.show()

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] imshow : text.py broken?

2007-09-03 Thread Jouni K . Seppänen
Xavier Gnata <[EMAIL PROTECTED]> writes:

> I do not know if we should post bug reports against matplotlib svn. 

Posting bug reports is likely to be helpful, but I suspect the
developers' list might be more appropriate for bugs in the svn version.
For bugs in released versions, I think John has told people to file a
bug in the Sourceforge tracker and also send a message to the mailing
list.

> Anyway, imshow is now fully broken this way :
[...]
> --> 200 w, h, d = renderer.get_text_width_height_descent(
> ValueError: need more than 2 values to unpack

It's not in imshow really, but in the usetex branch of
get_text_width_height_descent in the agg backend. I fixed the immediate
problem, though baseline alignment is unlikely to work with usetex as of
now.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] imshow : text.py broken?

2007-09-03 Thread Xavier Gnata
Hi,

I do not know if we should post bug reports against matplotlib svn. 
Please tell us.
Anyway, imshow is now fully broken this way :

imshow(ones((100,100)))

/usr/lib/python2.4/site-packages/matplotlib/pylab.py in imshow(*args, 
**kwargs)
   1960 try:
   1961 ret =  gca().imshow(*args, **kwargs)
-> 1962 draw_if_interactive()
   1963 except:
   1964 hold(b)

/usr/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py in 
draw_if_interactive()
 56 figManager =  Gcf.get_active()
 57 if figManager is not None:
---> 58 figManager.show()
 59
 60

/usr/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py in 
show(self)
350 if sys.platform=='win32' : self.window.update()
351 else:
--> 352 self.canvas.draw()
353 self._shown = True
354

/usr/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py in 
draw(self)
189
190 def draw(self):
--> 191 FigureCanvasAgg.draw(self)
192 tkagg.blit(self._tkphoto, self.renderer._renderer, 
colormode=2)
193 self._master.update_idletasks()

/usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py in 
draw(self)
381
382 self.renderer = self.get_renderer()
--> 383 self.figure.draw(self.renderer)
384
385 def get_renderer(self):

/usr/lib/python2.4/site-packages/matplotlib/figure.py in draw(self, 
renderer)
610
611 # render the axes
--> 612 for a in self.axes: a.draw(renderer)
613
614 # render the figure text

/usr/lib/python2.4/site-packages/matplotlib/axes.py in draw(self, 
renderer, inframe)
   1336
   1337 for zorder, i, a in dsu:
-> 1338 a.draw(renderer)
   1339
   1340 self.transData.thaw()  # release the lazy objects

/usr/lib/python2.4/site-packages/matplotlib/axis.py in draw(self, 
renderer, *args, **kwargs)
588 tick.set_label1(label)
589 tick.set_label2(label)
--> 590 tick.draw(renderer)
591 if tick.label1On and tick.label1.get_visible():
592 extent = tick.label1.get_window_extent(renderer)

/usr/lib/python2.4/site-packages/matplotlib/axis.py in draw(self, renderer)
168 if self.tick2On: self.tick2line.draw(renderer)
169
--> 170 if self.label1On: self.label1.draw(renderer)
171 if self.label2On: self.label2.draw(renderer)
172

/usr/lib/python2.4/site-packages/matplotlib/text.py in draw(self, renderer)
773 def draw(self, renderer):
774 self.update_coords(renderer)
--> 775 Text.draw(self, renderer)
776 if self.get_dashlength() > 0.0:
777 self.dashline.draw(renderer)

/usr/lib/python2.4/site-packages/matplotlib/text.py in draw(self, renderer)
315 angle = self.get_rotation()
316
--> 317 bbox, info = self._get_layout(renderer)
318 trans = self.get_transform()
319 if rcParams['text.usetex']:

/usr/lib/python2.4/site-packages/matplotlib/text.py in _get_layout(self, 
renderer)
198 baseline = None
199 for line in lines:
--> 200 w, h, d = renderer.get_text_width_height_descent(
201 line, self._fontproperties, 
ismath=self.is_math_text(line))
202 if baseline is None:

ValueError: need more than 2 values to unpack

I have tried both Tk and GTKagg backends with the same result.

Xavier.

-- 

Xavier Gnata
CRAL - Observatoire de Lyon
9, avenue Charles André
69561 Saint Genis Laval cedex
Phone: +33 4 78 86 85 28
Fax: +33 4 78 86 83 86
E-mail: [EMAIL PROTECTED]
 


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Saving just a colorbar

2007-09-03 Thread Jose Gomez-Dans
Hi,
I am using Matplotlib to produce colormaps which I use with other
programs. I would like to produce a PNG file with the used colormap
(so that I can overlay). Rather than doing an imshow()
followed by colorbar, is there an easy way I could pass the colorbar
my cmap instance to have it plotted on its own? In essence, what I
want to do is to do a savefig, and get something along the lines of
what is shown here: . I will
need to change the scale (i.e.,, the numbers :D) with each run.

So far, I have "cut+pasted" from a whole image, which is hardly convenient! :(

Cheers,
Jose

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users