Re: [Matplotlib-users] [newbie] live plots of multiple lines

2008-03-27 Thread Matthias Michler
On Wednesday 26 March 2008 19:39, Chris Withers wrote:
 Matthias Michler wrote:
  My x-axis is time, and as new points are plotted, even though I'm
  following the above recipe pretty closely, the x-tick spacing isn't
  getting sorted out, so I end up with just a jumble as the tick labels
  for the x-axis. Do you know why this might be?
 
  I'm not sure I understand correctly, but if the number of xticks
  increases dramatically (nobody could see the individual ticks),

 Indeed, it looks like the Tick spacing is staying as it was when the
 first point was plotted, so when hundreds more points are plotted, I
 just get a jumble of labels on the x-axis.

  the above script leads
  to a different behaviour on my system.

 What is that behaviour and what version of matplotlib are you using?

I think it is the expected behaviour. The number of xtick is aproximately 
constant and some tick get sorted out, when the xlimits are increasing.
I'm using matplotlib-svn r5024 on Debian etch.

  Shame I get that horrible exception when I do close the plot window,
  wish I knew how to make it stop :-S
 
  I don't know which exception you refer to, but sometimes if gives
  problems if the interactive mode wasn't switched off (ioff()) before
  the scripts ends or show() is called.

 If I run the attached script, and hit Ctrl-C in the DOS box running it,
 I get:

 C:\python mpltest.py
 Traceback (most recent call last):
File mpltest.py, line 3, in module
  show()
File
 C:\Python25\Lib\site-packages\matplotlib\backends\backend_tkagg.py, li
 e 76, in show
  Tk.mainloop()
File C:\Python25\lib\lib-tk\Tkinter.py, line 328, in mainloop
  _default_root.tk.mainloop(n)
 KeyboardInterrupt
 Fatal Python error: PyEval_RestoreThread: NULL tstate

 This application has requested the Runtime to terminate it in an unusual
 way.
 Please contact the application's support team for more information.

 I've had a similar error when I hit the red cross in the corner of the
 window with other scripts, although not this one :-S

sorry. I have no idea where this problems comes from. I have seen that using 
idle and the latest release of matplotlib on and winxp, but I can't reproduce 
it on my linux system.

Matthias

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: load data from string or array to Image

2008-03-27 Thread Anthony Floyd
On Wed, Mar 26, 2008 at 10:38 PM, sa6113 [EMAIL PROTECTED] wrote:

  I use matplotlib and Backend Agg to draw a plot , I want to show this plot in
  my GUI in specific area (Plot area) , I need to have the image object in

[snip]

  Is it clear?

Not to me :)

Do you mean that you've already created a plot and just want to show
it in your GUI?

What GUI toolkit are you using?  You may want to look in the various
embedding_in_*.py examples.

A

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Not scaling properly? Am I doing something wrong?

2008-03-27 Thread KURT PETERS
Forget it.  I was putting lat/long instead of long/lat.
Regards,
Kurt



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Not scaling properly? Am I doing something wrong?

2008-03-27 Thread Jeff Whitaker
KURT PETERS wrote:
 I'm trying what I thought was a simple test and getting bad results.  I am 
 taking some lat long coords, and feeding it into a map.  The conversion is 
 not giving real values that can be plotted on a map (and actually produces 
 an error when I use annotate).
 I'm including the simple code and the output:
   
 CODE
 
 import pylab as p
 import numpy
 from matplotlib.toolkits.basemap import Basemap as Basemap
 from matplotlib.colors import rgb2hex
 from matplotlib.patches import Polygon

 # Lambert Conformal map of lower 48 states.
 # create new figure
 fig=p.figure()
 m1 = Basemap(llcrnrlon=-119,llcrnrlat=22,urcrnrlon=-64,urcrnrlat=49,\
 
 projection='ortho',lat_1=33,lat_2=45,lon_0=-95,lat_0=40,resolution='c')


 #COS
 #D + M/60 + S/3600
 COSLat=38+56.0/60.0+0.013
 COSLon=-1*(104+48.0/60.0)
 WASHLat=38+53.0/60.0+23.0/3600.0
 WASHLon=-1*(77+32.0/3600.0)

 print COSLat
 x, y = m1(COSLat,COSLon)
 print 'x =%f, y=%f' % (x,y)

 m1.plot([x],[y],'ko')
 ax=p.gca()
 ax.annotate('COS1',(COSLat,COSLon))
 #ax.annotate('COS2',(x,y))
 ax.annotate('Wash1',(WASHLat,WASHLon))
 x, y = m1(WASHLat,WASHLon)
 #ax.annotate('Wash2',(x,y))

 m1.drawcoastlines()
 m1.fillcontinents()
 m1.drawcountries()
 m1.drawstates()
 m1.drawparallels(numpy.arange(25,65,4),labels=[1,0,0,0])
 m1.drawmeridians(numpy.arange(-120,-40,4),labels=[0,0,0,1])
 p.title('full resolution')
 p.show()
 Output
 38.946333
 x =100.00, 
 y=100.00

 Regards,
 Kurt

   

Kurt:  If you want the Lambert conformal projection, you should use 
projection='lcc', not 'ortho'. 

Nevertheless, your example works for me if I change the order of the 
arguments passed to the Basemap instance to

x, y = m1(COSLon,COSLat)

x, y = m1(WASHLon,WASHLat)

Note, longitude goes first.

Also, if you want 'full resolution' coastlines, use resolution='h'.

-Jeff



-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC  R/PSD1FAX   : (303)497-6449
325 BroadwayBoulder, CO, USA 80305-3328


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemaps - shapefile import/display for points

2008-03-27 Thread KURT PETERS
And, before someone asks, Why are you using h and this line:
h= [seg[0]*0.000278,seg[1]*0.000278]
ax.annotate(seqnum[nshape],h),
I was using this, instead, but tried to experiment with things to try to 
make things work right:
ax.annotate(seqnum[nshape],seg)
.
I usually don't give up and post a question unless I've tried a myriad of 
things, and unfortunately those things sometimes show up in the example 
code.

Regards,
Kurt



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [newbie] live plots of multiple lines

2008-03-27 Thread Chris Withers
Matthias Michler wrote:
 the above script leads
 to a different behaviour on my system.
 What is that behaviour and what version of matplotlib are you using?
 
 I think it is the expected behaviour. The number of xtick is aproximately 
 constant and some tick get sorted out, when the xlimits are increasing.
 I'm using matplotlib-svn r5024 on Debian etch.

Hmm, do you have a code snippet to demonstrate this?
Maybe I'm missing some vital step that causes the axis to re-calculate 
its ticks?

 sorry. I have no idea where this problems comes from. I have seen that using 
 idle and the latest release of matplotlib on and winxp, but I can't reproduce 
 it on my linux system.

*sigh* ;-)

Chris

-- 
Simplistix - Content Management, Zope  Python Consulting
- http://www.simplistix.co.uk


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Setting font family in ticks not possible. Bug?

2008-03-27 Thread Gerolf Ziegenhain
Dear Mailinglist,

Today I tried to change the fontset to sans-serif for a whole plot.
Everything except the ticks could be adjusted. 


This is what I tried first:
***
ffont = {'size':'20','family':'sans-serif'}
xticks(**ffont)
***
No change in the font family. But I can change the size without
problems. I removed the ~/.matplotlib/FONTCACHE stuff as described
here(2).


Following (1) I tried again to change the font using
***
import pylab
pylab.figure()
ax = pylab.axes()
ax.plot(pylab.arange(10))
xlabels = ax.get_xticklabels()
xlabel0 = xlabels[0]  # one of the xtick
labels
xlabel0.get_fontsize()
xlabel0.set_fontsize(20)
pylab.show() 
***
Again nothing changed.


Using ipython I got this:
***
In [192]: xlabels[0].get_fontname()
Out[192]: 'Bitstream Vera Serif, New Century Schoolbook, serif'

In [195]: xlabels[0].set_family(sans-serif)

In [196]: xlabels[0].get_fontname()
Out[196]: 'Bitstream Vera Sans, Lucida Grande, Verdana, sans-serif'

In [197]: show()
***


Summary:
It appears to me like I can change the default fontfamily, but somehow
there is no change in the output. 


What could be the problem?


Best regards:
   Gerolf

(1) http://www.nabble.com/axes-numbers-font-size-td14459877.html
(2) http://matplotlib.sourceforge.net/faq.html#FONTMISSING



-- 
Dipl. Phys. Gerolf Ziegenhain 
Web: http://gerolf.ziegenhain.com
Email:   [EMAIL PROTECTED]
Fax: +49 611 18840599
Phone:   +49 611 18840590
Office:  Erwin-Schrödinger-Str. 46 / Room 46.332 / 67663 Kaiserslautern / 
Germany
Private: Klopstockstr. 21 / 65187 Wiesbaden / Germany

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [newbie] live plots of multiple lines

2008-03-27 Thread Matthias Michler
Hello Chris,

On Thursday 27 March 2008 12:22, Chris Withers wrote:
 Matthias Michler wrote:
  the above script leads
  to a different behaviour on my system.
 
  What is that behaviour and what version of matplotlib are you using?
 
  I think it is the expected behaviour. The number of xtick is aproximately
  constant and some tick get sorted out, when the xlimits are increasing.
  I'm using matplotlib-svn r5024 on Debian etch.

 Hmm, do you have a code snippet to demonstrate this?
 Maybe I'm missing some vital step that causes the axis to re-calculate
 its ticks?

I'm not sure that I understand you correctly. The code I refering is the one 
which I attached some mails ago. The following works for me:
-
from pylab import *
from time import sleep

ion() # interactive mode 'on'
figure()
ax = subplot(111, autoscale_on=True)

x, y = [0], [0]
line = plot(x, y, label=my_data)[0]  
# get the line-object as the first element 
# of the tuple returned by plot
legend()
for i in arange(30):
x.append(i)   # append new values
y.append(i**2)
line.set_data(x,y)# reset data
ax.relim()# reset axes limits
ax.autoscale_view()   # rescale axes
draw()# redraw current figure
sleep(0.3)# wait 0.3 seconds

ioff()
show()
--

And your mpltest.py works as well for me. 

best regards
Matthias

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting font family in ticks not possible. Bug?

2008-03-27 Thread Michael Droettboom
Gerolf Ziegenhain wrote:
 Dear Mailinglist,

 Today I tried to change the fontset to sans-serif for a whole plot.
 Everything except the ticks could be adjusted. 


 This is what I tried first:
 ***
 ffont = {'size':'20','family':'sans-serif'}
 xticks(**ffont)
 ***
   
Hmmm...  This works for me.  What backend are you using?  Perhaps it 
isn't updating?  Also, do these two lines + show() alone not work, or is 
it only in the context of something else?

Also, what platform are you on?

Mike

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


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [wxpython-users] Controlling the wxpython matplotlib-frame

2008-03-27 Thread Laurent Dufrechou
Have you tryied : ipython -pylab ?
It launch an ipython shell that support mathplotlib gui loop.

-Message d'origine-
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
] De la part de Wolfgang Kerzendorf
Envoyé : mercredi 26 mars 2008 08:31
À : matplotlib-users@lists.sourceforge.net;
[EMAIL PROTECTED]
Objet : [wxpython-users] Controlling the wxpython matplotlib-frame

Hello all,
I have trouble with one of my scripts that uses matplotlib when using  
python or ipython. The first time it opens, it does not hand the  
control back o the shell and can be used to work on the matplotlib  
figure interactively (I use an event handler and picker objects to  
change my plots) so it works really well. After I close the window the  
control is given back to the shell. This is how I want it to work,  
however at the second time the matplotlib plot opens the shell does  
not stop anymore, the script continues. When I used GTKAgg on my old  
linux box I had the same issue and bound a key to  
pylab.get_current_figure_manager().destroy(), which looked like a hack  
to me but  worked. This does not work anymore with wxPython, because  
the next time I open a plot I get an exception:

PyDeadObjectError: The C++ part of the FigureFrameWxAgg object has  
been deleted, attribute access no longer allowed.

I also think destroying the figure_manager is not the right way to do  
that. Whats a goog solution for this?
Thanks in advance
 Wolfgang

P.S.: I know I posted a similar thing yesterday, but I thought  
rephrasing the question might help with finding the solution
___
wxpython-users mailing list
[EMAIL PROTECTED]
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [newbie] live plots of multiple lines

2008-03-27 Thread Chris Withers
Matthias Michler wrote:
 I'm not sure that I understand you correctly. The code I refering is the one 
 which I attached some mails ago. The following works for me:

Ah, okay, to get the problem I was having, change your script as follows:

 -
 from pylab import *
  from datetime import datetime
 from time import sleep
 
 ion() # interactive mode 'on'
 figure()
 ax = subplot(111, autoscale_on=True)
 
 x, y = [datetime.now()], [0]
 line = plot(x, y, label=my_data)[0]  
 # get the line-object as the first 
 element 
 # of the tuple returned by plot
 legend()
 for i in arange(30):
 x.append(datetime.now())   # append new values
 y.append(i**2)
 line.set_data(x,y)# reset data
 ax.relim()# reset axes limits
 ax.autoscale_view()   # rescale axes
 draw()# redraw current figure
 sleep(0.3)# wait 0.3 seconds
 
 ioff()
 show()

So, basically make the x axis time instead of numbers.
I think the problem is actually that the daets are quite long in their 
format. If they were rotated through 90 degress it'd likely be fine.
How would I do this?

Also, how would I get this kind of updating with bar charts or errorbars?

cheers,

Chris

-- 
Simplistix - Content Management, Zope  Python Consulting
- http://www.simplistix.co.uk

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting font family in ticks not possible. Bug?

2008-03-27 Thread Gerolf Ziegenhain
More complete:

I tried all permunations of backends. Now I stick to PS, because I use
matplotlib from commandline with scripts. The environment is debian/etch
with a current version of matplotlib (self compiled).

Try this script

from pylab import *

t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s)
grid(True)

# matlab handle graphics style
xticklines = getp(gca(), 'xticklines')
yticklines = getp(gca(), 'yticklines')
xgridlines = getp(gca(), 'xgridlines')
ygridlines = getp(gca(), 'ygridlines')
xticklabels = getp(gca(), 'xticklabels')
yticklabels = getp(gca(), 'yticklabels')

setp(xticklines, 'linewidth', 3)
setp(yticklines, 'linewidth', 3)
setp(xgridlines, 'linestyle', '-')
setp(ygridlines, 'linestyle', '-')
setp(yticklabels, 'color', 'r', fontsize='medium')
setp(xticklabels, 'color', 'r', fontsize='medium', family='sans-serif')

savefig('axprops_demo')
**

On my system the line
 setp(xticklabels, 'color', 'r', fontsize='medium', family='sans-serif')
doesn't change the font family.

Best regards:
 Gerolf
-- 
Dipl. Phys. Gerolf Ziegenhain ([EMAIL PROTECTED])
Private: Klopstockstrasse 21 - 65187 Wiesbaden - Germany
Office: Room 46-332 - Erwin-Schrödinger-Str.46 - TU Kaiserslautern - Germany
Web: gerolf.ziegenhain.com
Tel.: +49-611-18840590
Fax: +49-611-18840599
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] unicode filenames and MPL.

2008-03-27 Thread Christopher Barker
Michael Droettboom wrote:
 I think the real reason this wasn't done is that its tricky to do at the 
 C level in a cross-platform way.  At present it uses the regular POSIX 
 fopen in C, which isn't really Unicode aware.

The actual error is from trying to put the filename in a std::string, 
but yes, I'm sure the fopen issue is the driver. Does C++ offer anything 
better?

   See the Unicode
 filenames section of the link below for some of the complications.  
 Linux is particularly hard to get right:
 
 http://www.amk.ca/python/howto/unicode

Thanks, that's a good one.

   you can do the following as a workaround
 (with a performance hit from making many Python function calls):
 
   savefig(open(uCrazyUnicodeFilename.png, w))

thanks, I'll give that a try. I'm confused, though, why the many Python 
function calls? the C++ code doesn't just grab the file pointer?

Thanks,
-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] saving a PNg jsut as dispalyed

2008-03-27 Thread Christopher Barker
Ryan Krauss wrote:
 I think this line in the rc file is the trick
 
 #savefig.dpi   : 100

nope. I think all that does is set the default dpi for savefig. I don't 
want any default, I want it to use the same dpi that is being used for 
display, and I don't know ahead of time what that is, I expect it is 
system dependent.

Or do you mean that if I comment out that line, it will default to the 
one already in use? In which case, I need to go figure out how to change 
that in code, rather than messing with my matplotlibrc.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting font family in ticks not possible. Bug?

2008-03-27 Thread Darren Dale
On Thursday 27 March 2008 01:27:28 pm Gerolf Ziegenhain wrote:
 More complete:

 I tried all permunations of backends. Now I stick to PS, because I use
 matplotlib from commandline with scripts. The environment is debian/etch
 with a current version of matplotlib (self compiled).

 Try this script
 
 from pylab import *

 t = arange(0.0, 2.0, 0.01)
 s = sin(2*pi*t)
 plot(t, s)
 grid(True)

 # matlab handle graphics style
 xticklines = getp(gca(), 'xticklines')
 yticklines = getp(gca(), 'yticklines')
 xgridlines = getp(gca(), 'xgridlines')
 ygridlines = getp(gca(), 'ygridlines')
 xticklabels = getp(gca(), 'xticklabels')
 yticklabels = getp(gca(), 'yticklabels')

 setp(xticklines, 'linewidth', 3)
 setp(yticklines, 'linewidth', 3)
 setp(xgridlines, 'linestyle', '-')
 setp(ygridlines, 'linestyle', '-')
 setp(yticklabels, 'color', 'r', fontsize='medium')
 setp(xticklabels, 'color', 'r', fontsize='medium', family='sans-serif')

 savefig('axprops_demo')
 **

 On my system the line
  setp(xticklabels, 'color', 'r', fontsize='medium', family='sans-serif')
 doesn't change the font family.

Do you use usetex? If you do, the mathtext is rendered using latex, and 
latex renders mathtext in serif fonts.

Darren

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] saving a PNg jsut as dispalyed

2008-03-27 Thread Ryan Krauss
I guess you could read the rcParams value that corresponds to the
screen display and set rcParams['savefig.dpi'] to that value (this
might work):

mydpi = rcParams['figure.dpi']
rcParams['savefig.dpi'] = mydpi

But that seems slightly hackish and maybe not much more elegant than
what you are currently doing with passing dpi into savefig.

FWIW,

Ryan

On Thu, Mar 27, 2008 at 1:57 PM, Christopher Barker
[EMAIL PROTECTED] wrote:
 Ryan Krauss wrote:
   I think this line in the rc file is the trick
  
   #savefig.dpi   : 100

  nope. I think all that does is set the default dpi for savefig. I don't
  want any default, I want it to use the same dpi that is being used for
  display, and I don't know ahead of time what that is, I expect it is
  system dependent.

  Or do you mean that if I comment out that line, it will default to the
  one already in use? In which case, I need to go figure out how to change
  that in code, rather than messing with my matplotlibrc.



  -Chris



  --
  Christopher Barker, Ph.D.
  Oceanographer

  Emergency Response Division
  NOAA/NOS/ORR(206) 526-6959   voice
  7600 Sand Point Way NE   (206) 526-6329   fax
  Seattle, WA  98115   (206) 526-6317   main reception

  [EMAIL PROTECTED]

  -
  Check out the new SourceForge.net Marketplace.
  It's the best place to buy or sell services for
  just about anything Open Source.
  http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [Pythonmac-SIG] py2app and matplotlib

2008-03-27 Thread Christopher Barker
Ronald Oussoren wrote:
 That load command is for LC_UUID. The version of macholib in subversion 
 should have some support that is (basicly ignoring the entire load 
 command because macholib won't have to change it), could you test that 
 (easy_install macholib==dev)?

Yup, that problem is solved. Now it complains that I don't have wxPython 
libs, so I guess I need to make sure to import it explicitly, rather 
than letting matplotlib do it for me, so py2app will find it.

I got this error at some point:

/usr/bin/strip: the __LINKEDIT segment does not cover the end of the 
file (can't be processed) in: 
/Users/cbarker/HAZMAT/SmallToolsSVN/phCalculator/trunk/dist/test.app/Contents/Frameworks/libncurses.5.dylib
 
(for architecture i386)

But it seems to work -- is that a problem? And I don't know why I need 
ncurses anyway!

So, in summary:

with the latest py2app and removing the pytz line from the recipe, I 
have py2app working with MPL. Note that I'm not doing anything with 
time, so I don't know if there is a pytz problem or not.

-Chris





-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Zero length quiver/savefig bug

2008-03-27 Thread Andrew Charles
Quiver doesn't seem to be able to handle begin passed zeros for the
vector lengths. The full error output is below. I'm running Leopard
with macpython 2.5.2 using
matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg

The following code does not work:

rx = numpy.array([0.0,0.0])
ry = numpy.array([1.0,-1.0])
ax = numpy.array([0.0,0.0])
ay = numpy.array([0.0,0.0])

quiver(rx,ry,ax,ay)
savefig(image2.png,format='png')

The same code works if any of ax or ay are nonzero.


Cheers,

Andrew Charles

---

Error output:

spinode: ./test_case.py
Traceback (most recent call last):
  File ./test_case.py, line 24, in module
savefig(image2.png,format='png')
  File 
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/pyplot.py,
line 269, in savefig
return fig.savefig(*args, **kwargs)
  File 
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/figure.py,
line 782, in savefig
self.canvas.print_figure(*args, **kwargs)
  File 
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/backends/backend_wxagg.py,
line 101, in print_figure
FigureCanvasAgg.print_figure(self, filename, *args, **kwargs)
  File 
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/backend_bases.py,
line 1201, in print_figure
self.figure.canvas.draw()
  File 
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/backends/backend_wxagg.py,
line 61, in draw
FigureCanvasAgg.draw(self)
  File 
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/backends/backend_agg.py,
line 358, in draw
self.figure.draw(self.renderer)
  File 
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/figure.py,
line 624, in draw
for a in self.axes: a.draw(renderer)
  File 
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/axes.py,
line 1345, in draw
a.draw(renderer)
  File 
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/quiver.py,
line 336, in draw
verts = self._make_verts(self.U, self.V)
  File 
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.3-i386.egg/matplotlib/quiver.py,
line 386, in _make_verts
length = a/(self.scale*self.width)
  File /Library/Python/2.5/site-packages/numpy/ma/core.py, line
1679, in __div__
return divide(self, other)
  File /Library/Python/2.5/site-packages/numpy/ma/core.py, line 614,
in __call__
numpy.putmask(d2, t, self.filly)


test_case.py
Description: Binary data
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] scipy, matplotlib import errors

2008-03-27 Thread John
Hello, could someone please help me understand a strange problem, possibly
associated with PYTHONPATH. When I import matplotlib, pylab, or scipy from
any directory other than the root installation directory, it fails. However,
if I'm in the python installation directory there are no errors. Thanks in
advance! Please see below:

[EMAIL PROTECTED] ~]$ python*
Python 2.5.1 (r251:54863, Mar  7 2008, 04:10:12)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type help, copyright, credits or license for more information.
 import scipy
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.5/site-packages/scipy/__init__.py, line 18, in
module
import pkg_resources as _pr # activate namespace packages (manipulates
__path__)
  File /usr/lib/python2.5/site-packages/pkg_resources.py, line 2581, in
module
add_activation_listener(lambda dist: dist.activate())
  File /usr/lib/python2.5/site-packages/pkg_resources.py, line 640, in
subscribe
callback(dist)
  File /usr/lib/python2.5/site-packages/pkg_resources.py, line 2581, in
lambda
add_activation_listener(lambda dist: dist.activate())
  File /usr/lib/python2.5/site-packages/pkg_resources.py, line 2130, in
activate
map(declare_namespace, self._get_metadata('namespace_packages.txt'))
  File /usr/lib/python2.5/site-packages/pkg_resources.py, line 1749, in
declare_namespace
_handle_ns(packageName, path_item)
  File /usr/lib/python2.5/site-packages/pkg_resources.py, line 1712, in
_handle_ns
module = sys.modules[packageName] = new.module(packageName)
AttributeError: 'module' object has no attribute 'module'

[EMAIL PROTECTED] ~]$ cd /usr/lib/python2.5/
[EMAIL PROTECTED] python2.5]$ python*
Python 2.5.1 (r251:54863, Mar  7 2008, 04:10:12)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type help, copyright, credits or license for more information.
 import scipy

[EMAIL PROTECTED] python2.5]$ cd
[EMAIL PROTECTED] ~]$ echo $PYTHONPATH*
:.:/usr/lib/python2.5/:.:/home/jfb/bin
[EMAIL PROTECTED] ~]$*
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users