Re: [Matplotlib-users] ploting with dates?

 Re: [Matplotlib-users] ploting with dates? From: John Hunter - 2005-05-26 19:52:38 ```>>>>> "Jeff" == Jeff Peery writes: Jeff> Hello, I am trying to learn how to plot using dates. In my Jeff> code I'm basically trying to do the following: Jeff> t1 = ['05/05/2005', '05/06/2005', '05/07/2005', Jeff> '05/08/2005'] Jeff> t3 = [1,2,3,4] Jeff> #plot data self.axes.plot_date(t1, t3, 'bo') Jeff> this doesn't work for me. What does the input for plot_date Jeff> need to look like? Thanks. From the plot_date help plot_date(self, d, y, fmt='bo', tz=None, **kwargs) PLOT_DATE(d, y, converter, fmt='bo', tz=None, **kwargs) d is a sequence of dates represented as float days since 0001-01-01 UTC and y are the y values at those dates. fmt is a plot format string. kwargs are passed on to plot. See plot for more information. See matplotlib.dates for helper functions date2num, num2date and drange for help on creating the required floating point dates tz is the timezone - defaults to rc value The snippet below should get you started... from matplotlib.dates import date2num from datetime import datetime def ymd(s): m,d,y = [int(num) for num in s.split('/')] return y,m,d t1 = ['05/05/2005', '05/06/2005', '05/07/2005', '05/08/2005'] datenums = date2num([datetime(*ymd(s)) for s in t1]) See also examples/date_demo*.py in the matplotlib src distro or zipped up here http://matplotlib.sourceforge.net/matplotlib_examples_0.80.zip JDH ```

 [Matplotlib-users] axis label overlaps grid values? From: Jeff Peery - 2005-05-24 17:26:51 ```Hello, does anyone know how to move a y axis label so that it doesn't cover up the y axis grid values? Thanks for the help! Jeff ```
 [Matplotlib-users] py2exe From: Jeff Peery - 2005-05-24 20:14:42 ```Hello, can anyone give me a few pointers for getting py2exe to work with matplotlib? I'm having some trouble. I get a warning that the 'runtime has ended unexpectedly.' I had a similar problem before I started using matplotlib in my wxpython applications because for some reason python didn't like numarray. I removed all occurrences of it and replaced it with Numeric which solved my problem. Also it didn't like it when I imported modules using 'from'. So I replaced them with 'import'. Although since I started using matplotlib I added "from" in my header which now looks like this: import wxFrame1 import wxDialog4 import wx import matplotlib matplotlib.use('WX') from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.backends.backend_wx import _load_bitmap from matplotlib.figure import Figure from matplotlib.mlab import normpdf I am not sure how to change the "from's" to "import's" here and I also don't know why when I run py2exe it searches for numarray ( I know this because py2exe tells me its missing ) Anyhow I'm not sure any of this is related to the current problem. If anyone has some experience with getting py2exe working with matplotlib I would appreciate the help. Thanks. ```
 Re: [Matplotlib-users] py2exe From: John Hunter - 2005-05-24 20:30:47 ```>>>>> "Jeff" == Jeff Peery writes: Jeff> Hello, can anyone give me a few pointers for getting py2exe Have you seen this? http://matplotlib.sourceforge.net/faq.html#PY2EXE JDH ```
 [Matplotlib-users] ploting with dates? From: Jeff Peery - 2005-05-26 19:35:36 ```Hello, I am trying to learn how to plot using dates. In my code I'm basically trying to do the following: t1 = ['05/05/2005', '05/06/2005', '05/07/2005', '05/08/2005'] t3 = [1,2,3,4] #plot data self.axes.plot_date(t1, t3, 'bo') this doesn't work for me. What does the input for plot_date need to look like? Thanks. Jeff ```
 Re: [Matplotlib-users] ploting with dates? From: John Hunter - 2005-05-26 19:52:38 ```>>>>> "Jeff" == Jeff Peery writes: Jeff> Hello, I am trying to learn how to plot using dates. In my Jeff> code I'm basically trying to do the following: Jeff> t1 = ['05/05/2005', '05/06/2005', '05/07/2005', Jeff> '05/08/2005'] Jeff> t3 = [1,2,3,4] Jeff> #plot data self.axes.plot_date(t1, t3, 'bo') Jeff> this doesn't work for me. What does the input for plot_date Jeff> need to look like? Thanks. From the plot_date help plot_date(self, d, y, fmt='bo', tz=None, **kwargs) PLOT_DATE(d, y, converter, fmt='bo', tz=None, **kwargs) d is a sequence of dates represented as float days since 0001-01-01 UTC and y are the y values at those dates. fmt is a plot format string. kwargs are passed on to plot. See plot for more information. See matplotlib.dates for helper functions date2num, num2date and drange for help on creating the required floating point dates tz is the timezone - defaults to rc value The snippet below should get you started... from matplotlib.dates import date2num from datetime import datetime def ymd(s): m,d,y = [int(num) for num in s.split('/')] return y,m,d t1 = ['05/05/2005', '05/06/2005', '05/07/2005', '05/08/2005'] datenums = date2num([datetime(*ymd(s)) for s in t1]) See also examples/date_demo*.py in the matplotlib src distro or zipped up here http://matplotlib.sourceforge.net/matplotlib_examples_0.80.zip JDH ```