Hey Che -

If you include your graphs in a wxPython app, you shouldn't use pylab.
Pylab is a wrapper to (quickly) generate graphs, and is very useful, especially in interactive mode, as it saves a lot of typing and is much easier to understand (indeed, a lot like matlab plotting). But for inclusion in apps you need to use matplotlib, so you are on the right track. This has been discussed several times on the list, but it may not be so easy to find. Maybe we should put this on the FAQ page (or maybe it is already there!),

Mark

On 9/4/07, C M <cmpython@gmail.com> wrote:
Mark, Mark, Brendan, John, thanks for the input.  I have a related question that may help to continue to clear things up for me.  My goal is to use matplotlib with wxPython, and I've been able to embed graphs in wxPython apps fine so far (in this case, directly, not using wxMPL).  What I wanted to know is whether it is necessary to use pylab or not.  I am a little unclear what the purpose of pylab is in distinction to matplotlib itself.  I gather that pylab is a way to sort of emulate Matlab, but I am unclear as to whether I need to be using pylab in my apps or not.  I am not doing scientific plots, just fairly simple graphs, though I may throw some regression lines and r values on there at some point. 

I really just want to keep things as simple as possible, and if I don't need to use pylab, I'd rather not.  Any insight would be helpful.  Thank you.
Che M


On 9/4/07, Mark Bakker <markbak@gmail.com> wrote:
Maybe this will get you going:

import pylab as p
import datetime as d
from matplotlib.dates import DateFormatter
t = [ d.datetime (2007,9,1,12), d.datetime(2007,9,2,12), d.datetime(2007,9,3,12) ]
t = p.date2num(t)
p.plot_date( t, [10,20,30] )
p.xticks(t)
y = DateFormatter('%Y-%m-%d')
p.gca().xaxis.set_major_formatter(y)
p.draw()

Mark

From: "C M" <cmpython@gmail.com>
Subject: [Matplotlib-users] basic understanding of plotting dates

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