Re: [Matplotlib-users] Change xaxis labels

2012-02-07 Thread Paul Ivanov
C M, on 2012-02-06 09:33,  wrote:
 On Mon, Feb 6, 2012 at 9:23 AM, David Craig dcdavem...@gmail.com wrote:
 
  Hi, I have a plot and the xaxis shows number of seconds after a start
  point. I would like to convert them to days anyone know how to do this.
  I have looked at the documentation but cant find what I need.
 
 Couldn't you divide your data points by the conversion (86400) before
 plotting?  E.g., 432,000 seconds then becomes 5 days.

Another way to do this is to change the Formatter which generates
what the labels of each tick out to be to do this computation.

Take a look at this example:
http://matplotlib.sourceforge.net/examples/api/date_index_formatter.html

Just define something like:

def your_function(x,pos=None):
return %d days % (x/86400)

ax.xaxis.set_major_formatter(ticker.FuncFormatter(your_function))

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Change xaxis labels

2012-02-06 Thread David Craig
Hi, I have a plot and the xaxis shows number of seconds after a start 
point. I would like to convert them to days anyone know how to do this. 
I have looked at the documentation but cant find what I need.

--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Change xaxis labels

2012-02-06 Thread C M
On Mon, Feb 6, 2012 at 9:23 AM, David Craig dcdavem...@gmail.com wrote:

 Hi, I have a plot and the xaxis shows number of seconds after a start
 point. I would like to convert them to days anyone know how to do this.
 I have looked at the documentation but cant find what I need.


Couldn't you divide your data points by the conversion (86400) before
plotting?  E.g., 432,000 seconds then becomes 5 days.
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users