Re: [Matplotlib-users] Importing Null data points

2009-04-10 Thread Eric Firing
Ciarán Mooney wrote:
> Hi,
> 
> I have an ASCII data set, which includes null data points. eg
> 
> 1 x1 y1 z1
> 2 x2 y2 z2
> 3 x3 y3 z3
> 4  y3 z3
> 5  y4 z4
> 6  y5
> 
> I am using ipython with pylab enabled, and the load("/xxx/xxx")
> function. However it chokes on the blank, "null", values. How can I
> get this data set into matplotlib?

I assume the file is using fixed-length fields.  I don't know of any 
ready-made tool for reading files with non-delimited fields, with or 
without gaps, so you probably have to write your own to fit your 
particular file.  The general approach would be to read a line in as a 
character string, use slices to isolate the fields, try to convert each 
to a number, and if it fails put in a flag value.  These numbers can go 
in a list, and as you go through the lines you accumulate the lists in a 
list.  Then you can use numpy.ma.masked_equal(your_list_of_lists, 
your_flag_value) to create a 2-D masked array suitable for use by mpl.

Eric

> 
> Regards,
> 
> Ciarán
> 
> --
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How do I install Matplotlib 0.98 on Ubuntu 8.04 Hardy Heron?

2009-04-10 Thread bollweevil

sudo apt-get install python-matplotlib
#This only gets matplotlib-0.91

I have tried downloading the matplotlib-0.98.5.2.tar.gz, but it requires an
incredibly large number of prerequisites, and each of the prerequisites
requires prerequisites, and I have now wasted hours on this.

Please help me install matplotlib-0.98 on Ubuntu 8.04 Hardy Heron. I know
that there is an apt-get package to install matplotlib-0.98 on Ubuntu
Jaunty, but I don't know how to use it on Hardy.

Thanks.
-- 
View this message in context: 
http://www.nabble.com/How-do-I-install-Matplotlib-0.98-on-Ubuntu-8.04-Hardy-Heron--tp22996008p22996008.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap Installation Errors

2009-04-10 Thread Andrew Straw
jtamir wrote:
> 
> Andrew Straw wrote:
>> Does that file .h exist at that location?
>>
> Yes, __multiarray_api.h is in
> ~/lib/python2.5/site-packages/numpy/core/include/numpy/ 
> I am installing with prefix set to home directory.
> 
> 
> 
> Andrew Straw wrote:
>> can you re-send the
>> output including the first error?
>>
> The full output is quite long - 1650 lines (attached)
> 
> 
>> $ python setup.py install --prefix=/home/jtamir > log
>> error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2
>> -Wall -Wstrict-prototypes -fPIC -Isrc
>> -I/home/jtamir/lib/python2.5/site-packages/numpy/core/include
>> -I/home/jtamir/include/python2.5 -c src/_proj.c -o
>> build/temp.linux-i686-2.5/src/_proj.o" failed with exit status 1
>>  http://www.nabble.com/file/p22992540/log log 

> compile options: '-Isrc 
> -I/home/jtamir/lib/python2.5/site-packages/numpy/core/include 
> -I/home/jtamir/include/python2.5 -c'
> gcc: src/_proj.c
> src/_proj.c:4:20: error: Python.h: No such file or directory

That's the first error -- and it's quite diagnostic. gcc can't find
Python.h.

I see you are doing some slightly non-standard stuff with paths. From
your paths, it appears you have Python installed in
/home/jtamir/bin/python. If this is the case, you should try
"/home/jtamir/bin/python setup.py install" (without the
--prefix=/home/jtamir). That will let distutils attempt to do everything
normally. Otherwise, you'll have to figure out what Python.h isn't in
/home/jtamir/include/python2.5 if you want the above to work.

-- 
Andrew D. Straw, Ph.D.
California Institute of Technology
http://www.its.caltech.edu/~astraw/

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] saving at a specified size

2009-04-10 Thread Michael McNeil Forbes

On 8 Apr 2009, at 12:29 PM, Gideon Simpson wrote:

> Is there a way to save a figured at a specified size?
> -gideon

I have always specified the figure size first in the figure command:

fig_width = 5 # Default unit is inches
fig_height = 3

plt.figure(figsize=(fig_width, fig_height))
plt.plot(...)
plt.savefig(...)

As long as you don't resize the figure, this will save the figure in  
the specified size.  I don't know if there is a good way to force the  
size after the fact, but things don't always scale nicely so I find it  
best to work with the desired size figure from the start.

Michael.



--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap Installation Errors

2009-04-10 Thread jtamir


Andrew Straw wrote:
> 
> Does that file .h exist at that location?
> 
Yes, __multiarray_api.h is in
~/lib/python2.5/site-packages/numpy/core/include/numpy/ 
I am installing with prefix set to home directory.



Andrew Straw wrote:
> 
> can you re-send the
> output including the first error?
> 
The full output is quite long - 1650 lines (attached)


> $ python setup.py install --prefix=/home/jtamir > log
> error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2
> -Wall -Wstrict-prototypes -fPIC -Isrc
> -I/home/jtamir/lib/python2.5/site-packages/numpy/core/include
> -I/home/jtamir/include/python2.5 -c src/_proj.c -o
> build/temp.linux-i686-2.5/src/_proj.o" failed with exit status 1
>  http://www.nabble.com/file/p22992540/log log 

Jon


-- 
View this message in context: 
http://www.nabble.com/Basemap-Installation-Errors-tp22915617p22992540.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib._path failed on windows build for Python 2.6

2009-04-10 Thread Lorenzo Di Gregorio
Ouch, it looks like MinGW and Python do not fit 100% to each other.
Please check out this bug report:

http://bugs.python.org/issue3308

"Basically MinGW erroneously ships a .lib saying localtime is in
MSVCR90.DLL when it isn't.  That means there is no link failure but the
*pyd* will fail to load without information as to why.  Fixing the .lib
means that localtime is picked up from MSVCRT.DLL (ie no version in
name) and everything appears to work well."


On 4/10/09, Lorenzo Di Gregorio  wrote:
>
> On 4/10/09, Michael Droettboom  wrote:
>>
>> Lorenzo Di Gregorio wrote:
>>
>>> Well, that's exactly the problem: I just can't load some DLLs!
>>>  >>> import matplotlib._path
>>>
>>> Traceback (most recent call last):
>>>  File "", line 1, in 
>>>import matplotlib._path
>>> ImportError: DLL load failed: Die angegebene Prozedur wurde nicht
>>> gefunden.
>>> >>> import matplotlib._delaunay
>>> >>> import matplotlib._image
>>>
>>> Traceback (most recent call last):
>>>  File "", line 1, in 
>>>import matplotlib._image
>>> ImportError: DLL load failed: Die angegebene Prozedur wurde nicht
>>> gefunden.
>>>
>>> I have run python -vv, it tries also ..._path but does not load it, so I
>>> think it might be a linking problem.
>>> I've noticed that _delaunay.cpp has a "PyMODINIT_FUNC
>>> init_delaunay(void)" while _path.cpp has just a "void init_path(void)".
>>>
>> If you make that change, does it work?
>
>
> No, I tried.
>
> I have also tried to start python -vv.
> For _delaunay I get a correct import.
>
> # trying C:\Python26\lib\site-packages\matplotlib\_delaunay.pyd
> import matplotlib._delaunay # dynamically loaded from
> C:\Python26\lib\site-packages\matplotlib\_delaunay.pyd
>
> For _path and _image I get
>
> >>> import matplotlib._path
> # trying C:\Python26\lib\site-packages\matplotlib\_path.pyd
> Traceback (most recent call last):
>   File "", line 1, in 
> ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden.
> >>> import matplotlib._image
> # trying C:\Python26\lib\site-packages\matplotlib\_image.pyd
> Traceback (most recent call last):
>   File "", line 1, in 
> ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden.
>
> So Python checks the right place but then concludes that the DLL is not
> there.  I guess something goes wrong with the linking, but in fact I do not
> know how to write a DLL for Python and I'm stuck now.
> I have checked that the compilation was ok and the rest of the installation
> (GTK+ etc) is ok.  I can import matplotlib itself.  In the packages I had
> only one package to patch: I think "gpobjects" had a reference to "@FFI_LIB@".
> This was getting through pkg-config and stopping the compilation, so I have
> removed it.
>
> ... HELP! ;-)
>
> Regards,
> Lorenzo
>
--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib._path failed on windows build for Python 2.6

2009-04-10 Thread Lorenzo Di Gregorio
On 4/10/09, Michael Droettboom  wrote:
>
> Lorenzo Di Gregorio wrote:
>
>> Well, that's exactly the problem: I just can't load some DLLs!
>>  >>> import matplotlib._path
>>
>> Traceback (most recent call last):
>>  File "", line 1, in 
>>import matplotlib._path
>> ImportError: DLL load failed: Die angegebene Prozedur wurde nicht
>> gefunden.
>> >>> import matplotlib._delaunay
>> >>> import matplotlib._image
>>
>> Traceback (most recent call last):
>>  File "", line 1, in 
>>import matplotlib._image
>> ImportError: DLL load failed: Die angegebene Prozedur wurde nicht
>> gefunden.
>>
>> I have run python -vv, it tries also ..._path but does not load it, so I
>> think it might be a linking problem.
>> I've noticed that _delaunay.cpp has a "PyMODINIT_FUNC init_delaunay(void)"
>> while _path.cpp has just a "void init_path(void)".
>>
> If you make that change, does it work?


No, I tried.

I have also tried to start python -vv.
For _delaunay I get a correct import.

# trying C:\Python26\lib\site-packages\matplotlib\_delaunay.pyd
import matplotlib._delaunay # dynamically loaded from
C:\Python26\lib\site-packages\matplotlib\_delaunay.pyd

For _path and _image I get

>>> import matplotlib._path
# trying C:\Python26\lib\site-packages\matplotlib\_path.pyd
Traceback (most recent call last):
  File "", line 1, in 
ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden.
>>> import matplotlib._image
# trying C:\Python26\lib\site-packages\matplotlib\_image.pyd
Traceback (most recent call last):
  File "", line 1, in 
ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden.

So Python checks the right place but then concludes that the DLL is not
there.  I guess something goes wrong with the linking, but in fact I do not
know how to write a DLL for Python and I'm stuck now.
I have checked that the compilation was ok and the rest of the installation
(GTK+ etc) is ok.  I can import matplotlib itself.  In the packages I had
only one package to patch: I think "gpobjects" had a reference to "@FFI_LIB@".
This was getting through pkg-config and stopping the compilation, so I have
removed it.

... HELP! ;-)

Regards,
Lorenzo
--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Updating a plot

2009-04-10 Thread Andrew Straw
Pellegrini Eric wrote:
> Hello everybody,
>
> I would like to create a plot from which I set the x data later. The
> method set_xdata works but the corresponding plot displays the initial
> x limits. Is it possible to update the plot automatically in order
> that the displayed plot has x limits corresponding to the newly set x
> data ?
>
> Here is the script that fails:
>
> import pylab
> fig = pylab.figure()
> ax = fig.add_subplot(111, label = 'plot1')
> p, = ax.plot([1,2,3,4,5])
> p.set_xdata([10,20,30,40,50])
> # ax.set_xlim([10,50])
> fig.show()
>
> to update the xlim I have to add the commented line.
>
> thank you very much
>
> Eric Pellegrini
>
>
>   
I think this is more or less the same question asked by "C M" on April 8
on this list. Can you see if the response by Ryan May is sufficient for you?

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Display full number in ticks

2009-04-10 Thread Andrew Straw
Michael Droettboom wrote:
> Pim Schellart wrote:
>> Dear Matplotlib users/developers,
>>
>> The default behaviour of matplotlib.pyplot is to display large (e.g. 
>> 2452298.7554547498 as a small number 0.25545474980026484 + 
>> 2.4522985e6) I would like to be able to do one of the following.
>>
>> - Set the number to be subtracted manually (I know I can just subtract 
>> a number from the input array but then matplotib still subtracts 
>> another number if it thinks it is still to big to display).
> I don't know if there's a straightforward way to do this...  Maybe 
> someone more familiar with the ticking code can comment.

You can do
"ax.xaxis.set_major_formatter(ticker.FormatStrFormatter("%s"))" and then
the normal Python "%s"%myvar format handler will convert your datum to a
string.

The default formatter is pretty ugly in my opinion, as well. Someone
(me, probably) should endeavor to make rcParams out of this, as the
above code, or a variation of it, permeates my files.

>> - Force matplotlib to display the full number (and display the numbers 
>> slanted so they do not overlap). This is my preferred option. I would 
>> like to see this as a simple option in pyplot, perhaps as an extra 
>> parameter in the xticks/yticks functions (for the y axis the numbers 
>> don't need to be slanted).
> You can do "xticks(rotation=45)"  Does that do what you want?
> 
> Cheers,
> Mike
>> I tried a manual formatter but I think there should be an easy way to 
>> set this in pyplot and I could not figure out how to display the tick 
>> numbers slanted.
>>
>> Kind regards,
>>
>> Pim Schellart
>>
>> P.S. In the example number 2452298.7554547498 I also need to subtract 
>> 244 in order for the plot to render correctly. Otherwise all y 
>> values end up at the same x position which is a bug in the latest 
>> matplotlib release because it did not happen before.
>> 
>>
>> --
>> This SF.net email is sponsored by:
>> High Quality Requirements in a Collaborative Environment.
>> Download a free trial of Rational Requirements Composer Now!
>> http://p.sf.net/sfu/www-ibm-com
>> 
>>
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>   
> 


--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] different dimensions for subplots + same x label

2009-04-10 Thread Pau
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg03134.html

I'd like to understand the syntax, though...

For the shared x label I found something at the wiki, but it was a bit
obscure...

2009/4/10 Pau :
> Hello,
>
> is it possible to define the dimensions of a subplot to use 70% of the
> plot surface and the other one 30%?
>
> I'd also like the plots to share the same x label...
>
> how to do it?
>
> thanks
>



-- 
Let there be peace on earth. And let it begin with misc

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Lots of little problems with appearance (Agg vs. GTK, xlim, tick locators)

2009-04-10 Thread Michael Droettboom
Are you using the same version on matplotlib in both places?  What are 
the versions?  It seems unlikely these differences would be caused by 
the backend -- more likely just a version difference.

Mike

bollweevil wrote:
> Hello All,
>
> I am having lots of very frustrating little problems with Matplotlib.
>
> 1. Here is an example of one problem: the x-axis looks awful even though I
> coded a tick locator and tick formatter special:
> http://www.nabble.com/file/p22989017/inE.png 
> I think I know what caused this, too. While plotting, Python gave the
> error/warning "DeprecationWarning: integer argument expected, got float
> tzinfo=rr._ tzinfo". With many very similar data sets, it doesn't give that
> error and draws nice tick marks like this:
> http://www.nabble.com/file/p22989017/31%2B2009.png 
> Is the error caused by the fact that the data doesn't fill the whole X-axis?
> That would be an unfortunate reason to fail, especially considering the
> second problem...
>
> 2. Here is another problem: GTK on my MacBook always successfully changes
> the X-axis limits when I say plt.xlim(number1, number2). Using the Agg
> backend on an Ubuntu server (which doesn't have GTK because it is headless),
> xlim NEVER works. Ubuntu with Agg draws a graph fine, but it uses whatever
> limits it would have used default. Example from Ubuntu with Agg:
> http://www.nabble.com/file/p22989017/Matplotlib%2Bgraph%2B-%2BExemplifies%2Bdate%2Bformatting%2Band%2Bxlim%2Bbugs.png
>  
> Example from my MacBook with GTK:
> http://www.nabble.com/file/p22989017/22%2B2009.png 
>
> 3. The final problem is also demonstrated by the two example images in
> problem #2 above: Agg completely ignores my tick formatter, and perhaps also
> my tick locator. Why?
>
> Here is all of the relevant Matplotlib code I am using:
>
> plt.clf()
>   ax = plt.subplot(111)
>   if dateMin:
>   plt.xlim(xmin=dateMin, xmax=dateMax)
>   plt.plot(yDates, xIntensity)
>   xmin, xmax = plt.xlim()
>   xrange = num2date(xmax)-num2date(xmin)
>   if xrange < datetime.timedelta(hours=24):
>   widthInUnits = divideDelta(xrange, datetime.timedelta(hours=1))
>   stepRaw = widthInUnits/5. #The denominator here is the maximum 
> number of
> ticks on the x axis. So putting 5 in the denominator, as I have done here,
> means there will be up to 5 tick marks.
>   step = floor(stepRaw+1)
>   majorFormatter = DateFormatter('%I:%M %p')
>   majorLocator = HourLocator(interval=step)
>   elif xrange < datetime.timedelta(days=5):
>   widthInUnits = divideDelta(xrange, datetime.timedelta(hours=12))
>   stepRaw = widthInUnits/7.
>   step = floor(stepRaw+1)
>   majorFormatter = DateFormatter('%m/%d\n%I%p')
>   majorLocator = HourLocator(interval=step*12)
>   elif xrange < datetime.timedelta(days=300):
>   widthInUnits = divideDelta(xrange, datetime.timedelta(days=1))
>   stepRaw = widthInUnits/8.
>   step = floor(stepRaw+1)
>   majorFormatter = DateFormatter('%m/%d')
>   majorLocator = DayLocator(interval=step)
>   else:
>   widthInUnits = divideDelta(xrange, datetime.timedelta(days=30))
>   stepRaw = widthInUnits/7.
>   step = floor(stepRaw+1)
>   majorFormatter = DateFormatter('%b\n%Y')
>   majorLocator = MonthLocator(interval=int(step))
>   ax.xaxis.set_major_locator(majorLocator)
>   ax.xaxis.set_major_formatter(majorFormatter)
>   if dateMark:
>   for mark in dateMark:
>   l = plt.axvline(x=mark, color='r')
>   plt.savefig(str(filePath+'/'+fileNameExt))
>
> Thank you, I hope somebody can help.
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Lots of little problems with appearance (Agg vs. GTK, xlim, tick locators)

2009-04-10 Thread bollweevil

Hello All,

I am having lots of very frustrating little problems with Matplotlib.

1. Here is an example of one problem: the x-axis looks awful even though I
coded a tick locator and tick formatter special:
http://www.nabble.com/file/p22989017/inE.png 
I think I know what caused this, too. While plotting, Python gave the
error/warning "DeprecationWarning: integer argument expected, got float
tzinfo=rr._ tzinfo". With many very similar data sets, it doesn't give that
error and draws nice tick marks like this:
http://www.nabble.com/file/p22989017/31%2B2009.png 
Is the error caused by the fact that the data doesn't fill the whole X-axis?
That would be an unfortunate reason to fail, especially considering the
second problem...

2. Here is another problem: GTK on my MacBook always successfully changes
the X-axis limits when I say plt.xlim(number1, number2). Using the Agg
backend on an Ubuntu server (which doesn't have GTK because it is headless),
xlim NEVER works. Ubuntu with Agg draws a graph fine, but it uses whatever
limits it would have used default. Example from Ubuntu with Agg:
http://www.nabble.com/file/p22989017/Matplotlib%2Bgraph%2B-%2BExemplifies%2Bdate%2Bformatting%2Band%2Bxlim%2Bbugs.png
 
Example from my MacBook with GTK:
http://www.nabble.com/file/p22989017/22%2B2009.png 

3. The final problem is also demonstrated by the two example images in
problem #2 above: Agg completely ignores my tick formatter, and perhaps also
my tick locator. Why?

Here is all of the relevant Matplotlib code I am using:

plt.clf()
ax = plt.subplot(111)
if dateMin:
plt.xlim(xmin=dateMin, xmax=dateMax)
plt.plot(yDates, xIntensity)
xmin, xmax = plt.xlim()
xrange = num2date(xmax)-num2date(xmin)
if xrange < datetime.timedelta(hours=24):
widthInUnits = divideDelta(xrange, datetime.timedelta(hours=1))
stepRaw = widthInUnits/5. #The denominator here is the maximum 
number of
ticks on the x axis. So putting 5 in the denominator, as I have done here,
means there will be up to 5 tick marks.
step = floor(stepRaw+1)
majorFormatter = DateFormatter('%I:%M %p')
majorLocator = HourLocator(interval=step)
elif xrange < datetime.timedelta(days=5):
widthInUnits = divideDelta(xrange, datetime.timedelta(hours=12))
stepRaw = widthInUnits/7.
step = floor(stepRaw+1)
majorFormatter = DateFormatter('%m/%d\n%I%p')
majorLocator = HourLocator(interval=step*12)
elif xrange < datetime.timedelta(days=300):
widthInUnits = divideDelta(xrange, datetime.timedelta(days=1))
stepRaw = widthInUnits/8.
step = floor(stepRaw+1)
majorFormatter = DateFormatter('%m/%d')
majorLocator = DayLocator(interval=step)
else:
widthInUnits = divideDelta(xrange, datetime.timedelta(days=30))
stepRaw = widthInUnits/7.
step = floor(stepRaw+1)
majorFormatter = DateFormatter('%b\n%Y')
majorLocator = MonthLocator(interval=int(step))
ax.xaxis.set_major_locator(majorLocator)
ax.xaxis.set_major_formatter(majorFormatter)
if dateMark:
for mark in dateMark:
l = plt.axvline(x=mark, color='r')
plt.savefig(str(filePath+'/'+fileNameExt))

Thank you, I hope somebody can help.
-- 
View this message in context: 
http://www.nabble.com/Lots-of-little-problems-with-appearance-%28Agg-vs.-GTK%2C-xlim%2C-tick-locators%29-tp22989017p22989017.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] different dimensions for subplots + same x label

2009-04-10 Thread Pau
Hello,

is it possible to define the dimensions of a subplot to use 70% of the
plot surface and the other one 30%?

I'd also like the plots to share the same x label...

how to do it?

thanks

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Updating a plot

2009-04-10 Thread Pellegrini Eric
Hello everybody,

I would like to create a plot from which I set the x data later. The method 
set_xdata works but the corresponding plot displays the initial x limits. Is it 
possible to update the plot automatically in order that the displayed plot has 
x limits corresponding to the newly set x data ?

Here is the script that fails:

import pylab
fig = pylab.figure()
ax = fig.add_subplot(111, label = 'plot1')
p, = ax.plot([1,2,3,4,5])
p.set_xdata([10,20,30,40,50])
# ax.set_xlim([10,50])
fig.show()

to update the xlim I have to add the commented line.

thank you very much

Eric Pellegrini



  --
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Display full number in ticks

2009-04-10 Thread Michael Droettboom
Pim Schellart wrote:
> Dear Matplotlib users/developers,
>
> The default behaviour of matplotlib.pyplot is to display large (e.g. 
> 2452298.7554547498 as a small number 0.25545474980026484 + 
> 2.4522985e6) I would like to be able to do one of the following.
>
> - Set the number to be subtracted manually (I know I can just subtract 
> a number from the input array but then matplotib still subtracts 
> another number if it thinks it is still to big to display).
I don't know if there's a straightforward way to do this...  Maybe 
someone more familiar with the ticking code can comment.
> - Force matplotlib to display the full number (and display the numbers 
> slanted so they do not overlap). This is my preferred option. I would 
> like to see this as a simple option in pyplot, perhaps as an extra 
> parameter in the xticks/yticks functions (for the y axis the numbers 
> don't need to be slanted).
You can do "xticks(rotation=45)"  Does that do what you want?

Cheers,
Mike
>
> I tried a manual formatter but I think there should be an easy way to 
> set this in pyplot and I could not figure out how to display the tick 
> numbers slanted.
>
> Kind regards,
>
> Pim Schellart
>
> P.S. In the example number 2452298.7554547498 I also need to subtract 
> 244 in order for the plot to render correctly. Otherwise all y 
> values end up at the same x position which is a bug in the latest 
> matplotlib release because it did not happen before.
> 
>
> --
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> 
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Display full number in ticks

2009-04-10 Thread Pim Schellart

Dear Matplotlib users/developers,

The default behaviour of matplotlib.pyplot is to display large (e.g.  
2452298.7554547498 as a small number 0.25545474980026484 +  
2.4522985e6) I would like to be able to do one of the following.


- Set the number to be subtracted manually (I know I can just subtract  
a number from the input array but then matplotib still subtracts  
another number if it thinks it is still to big to display).
- Force matplotlib to display the full number (and display the numbers  
slanted so they do not overlap). This is my preferred option. I would  
like to see this as a simple option in pyplot, perhaps as an extra  
parameter in the xticks/yticks functions (for the y axis the numbers  
don't need to be slanted).


I tried a manual formatter but I think there should be an easy way to  
set this in pyplot and I could not figure out how to display the tick  
numbers slanted.


Kind regards,

Pim Schellart

P.S. In the example number 2452298.7554547498 I also need to subtract  
244 in order for the plot to render correctly. Otherwise all y  
values end up at the same x position which is a bug in the latest  
matplotlib release because it did not happen before.

smime.p7s
Description: S/MIME cryptographic signature
--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib._path failed on windows build for Python 2.6

2009-04-10 Thread Michael Droettboom
Lorenzo Di Gregorio wrote:
> Well, that's exactly the problem: I just can't load some DLLs!
>  
> >>> import matplotlib._path
>
> Traceback (most recent call last):
>   File "", line 1, in 
> import matplotlib._path
> ImportError: DLL load failed: Die angegebene Prozedur wurde nicht 
> gefunden.
> >>> import matplotlib._delaunay
> >>> import matplotlib._image
>
> Traceback (most recent call last):
>   File "", line 1, in 
> import matplotlib._image
> ImportError: DLL load failed: Die angegebene Prozedur wurde nicht 
> gefunden.
>
> I have run python -vv, it tries also ..._path but does not load it, so 
> I think it might be a linking problem.
> I've noticed that _delaunay.cpp has a "PyMODINIT_FUNC 
> init_delaunay(void)" while _path.cpp has just a "void init_path(void)".
If you make that change, does it work?

Mike
>  
> Best Regards,
> Lorenzo
>  
> On 4/9/09, *Michael Droettboom*  > wrote:
>
> Can you send us the output of this Python session to help us
> debug?  I'm curious what symbols *are* in there.
>
> >>> import matplotlib._path
> >>> dir(matplotlib._path)
> ['__doc__', '__file__', '__name__', 'affine_transform',
> 'clip_path_to_rect', 'convert_path_to_polygons',
> 'count_bboxes_overlapping_bbox', 'get_path_collection_extents',
> 'get_path_extents', 'path_in_path', 'path_intersects_path',
> 'point_in_path', 'point_in_path_collection', 'point_on_path',
> 'update_path_extents']
> >>>
>
> Cheers,
> Mike
>
> Lorenzo Di Gregorio wrote:
>
> On Thu, Apr 9, 2009 at 7:06 AM, Andrew Straw
> mailto:straw...@astraw.com>
> >> wrote:
>
>Lorenzo Di Gregorio wrote:
>> Hello,
>>
>> I've tried to build matplotlib 0.98.5.2 for Python 2.6
> under Windows
>> (Win2k) using MinGW and win32_static.  After a few fixes, the
>> compilation and install appear to be ok, but I've got
> stuck at
>> importing matplotlib._path (see transcript below).
>> Any suggestions on what is going wrong and how to fix it?
>>
>>   File
> "C:\Python26\lib\site-packages\matplotlib\artist.py", line 5,
>> in 
>>
>> from transforms import Bbox, IdentityTransform,
> TransformedBbox,
>> Transformed
>> Path
>>   File
> "C:\Python26\lib\site-packages\matplotlib\transforms.py",
>line
>> 34, in > dule>
>> from matplotlib._path import affine_transform
>> ImportError: DLL load failed: Die angegebene Prozedur
> wurde nicht
>> gefunden.
>>
>Did _path.cpp get compiled to a .pyd OK? (Do you have
>C:\PYTHON26\Lib\site-packages\matplotlib\_path.pyd
> installed? -- I
>guess
>that's where it would be... Not running Python on Windows,
> though, I
>could be off a bit.)
>
>
> Yes, that's compiled and installed at the location you mentioned.
> In fact I have no idea what is wrong with that.
> How does a .pyd reference a DLL and what is it supposed to load?
>  
>And, as a hint to anyone else attempting to debug this: the
> above
>traceback means "The given procedure was not found". (And
> Lorenzo Di
>Gregorio doesn't sound like a very German name to me, so
> why your
>computer is speaking German I don't know... :)
>
>
> Right, I don't know either why I haven't switched it already
> ;-) But mitigating circumstances for lazyness are that German
> is my second language, my wife is German, I live and work in
> Germany etc.
>
>I do find something nice about running Python 2.6 under Win2k,
>though...
>
>
> ... under Linux it was too easy ;-P (my company runs Win2k!)
> 
> 
>
> 
> --
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> 
> 
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>  
>
>
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
>