Re: [Matplotlib-users] [matplotlib-users] How to plot y vs x with some missing points in y vector?

2012-01-27 Thread Jérôme
Fri, 27 Jan 2012 16:48:25 +0100
Fabien Lafont a écrit:

 I want to plot something like:
 
 
 X(time)Ypoints
 08
 1
 2 7
 3
 4
 5
 6
 7
 8
 9

Sorry if I'm missing something, but can't you plot Y [8,7] against X [0,2] ?

-- 
Jérôme

--
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


[Matplotlib-users] plot_date issue : OverflowError: date value out of range

2011-12-13 Thread Jérôme
Hi all.

I'm trying to use plot_date and I get an error I don't understand.

I've reduced my problem to this small example:

-
from pylab import figure, show

dates = [301,302,303]
#dates = [1,2,303]
#dates = [1,2,3]
values = [1,2,4]

fig = figure()
ax = fig.add_subplot(111)
ax.plot_date(dates, values,'-')
fig.autofmt_xdate()

show()
-

This works. I get a plot with the values for the 301st, 302nd and 303rd day
of year one. (I don't actually mind the year, all I know is my simulation
starts the first of january of any year.)

If I use dates = [1,2,303], it works as well.

However, with dates = [1,2,3], it does not, and I get the error :
OverflowError: date value out of range

I don't understand. I may not be aware of everything concerning dates in
python, but as far as I understand, those dates are correct and are the
first three days of year one. Aren't they ?

Since I don't mind the year, I guess I could add an arbitrary number of years
to my dates as a workaround for this error.

Another question that could be related:
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg01720.html

Thanks for any help.

-- 
Jérôme

--
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and 
improve service delivery. Take 5 minutes to use this Systems Optimization 
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Dynamic adjustment of axis position and size in figure

2011-12-07 Thread Jérôme
Hi all.

The position of an axes is fixed at creation, regardless of the what goes
outside the plot area. If the numbers on the y-axis are big enough (say, 7
digits) and a label is added, the label gets out of the figure.

Example :

--

import pylab

data = [0,1,2,300]

fig = pylab.figure()

ax1 = fig.add_subplot(1,1,1)
ax1.plot(data)
ax1.set_ylabel('label_axis_y1')

pylab.show()

--

Is there a way to automatically resize the axis and nicely center the whole
set {axes + ticklabels + labels} in the figure ?

One could use add_axes and play with the coordinates until he gets something
nice, but it gets complicated to have it automatic as things depends on
- the number of digits of y-axis ticklabels
- whether or not a secundary y-axis is added on the right (using twinx)

Or did I miss something ?

Thanks.

-- 
Jérôme

--
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Dynamic adjustment of axis position and size in figure

2011-12-07 Thread Jérôme
Hi again.

Wed, 7 Dec 2011 20:29:22 +0100
Jérôme a écrit:

 Is there a way to automatically resize the axis and nicely center the whole
 set {axes + ticklabels + labels} in the figure ?

[...]
 
 Or did I miss something ?

It seems I missed figure.tight_layout().

Sorry about that...

-- 
Jérôme

--
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Dynamic adjustment of axis position and size in figure

2011-12-07 Thread Jérôme
Wed, 7 Dec 2011 20:29:22 +0100
Jérôme a écrit:

 Is there a way to automatically resize the axis and nicely center the whole
 set {axes + ticklabels + labels} in the figure ?
 
 One could use add_axes and play with the coordinates until he gets something
 nice, but it gets complicated to have it automatic as things depends on
 - the number of digits of y-axis ticklabels
 - whether or not a secundary y-axis is added on the right (using twinx)

Hi again, sorry for multi-posting.

Apparently, figure.tight_layout() does not take into account the secondary
y-axis on the right.

Is this a known limitation ? (I don't see it on the caveats paragraph [1].)

Or is this the use I make of it that is incorrect ?

Example :

--

import pylab

fig = pylab.figure()

data_1 = [0,1,2,3]
data_2 = [0,5,250,3]

lines = []

# Primary axis
ax1 = fig.add_subplot(1,1,1)
lines.extend (ax1.plot(data_1, 'b'))

# Secondary axis
ax2 = pylab.twinx(ax1)
lines.extend (ax2.plot(data_2, 'g'))

labels = ['Data 1', 'Data 2']

fig.tight_layout()

pylab.show()


--

Thanks.

[1] http://matplotlib.sourceforge.net/users/tight_layout_guide.html

-- 
Jérôme

--
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users