[Matplotlib-users] getting the min and max values of an axis for plotting

2008-05-12 Thread Johann Cohen-Tanugi
hello,
I have a function, which I am plotting. I want to add a line positioned 
at, say, the mean of the function, so I want to do plot([x,x],[y0,y1]).
In order to get y0, and y1, my brute force trial and error browsing of 
the API lead me to :
y0=gca().yaxis.get_majorticklabels()[0].get_position()[1]
y1=gca().yaxis.get_majorticklabels()[-1].get_position()[1]

 and as I am never contented, I now ask : is it really the manner of 
choice to get this information. I sense that I did not take the 
straightest path to get it :)

thanks in advance,
Johann

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [newb] batch processing

2008-05-12 Thread Neal Becker
To produce a batch of pdfs, I'm using:

close ()
figure (1, figsize=(11,8))
...
savefig (open (whatever, 'w'))

Works, but causes my display to flash, I think each time either close() or
figure() is called (not sure which).  Any better way?


-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [newb] batch processing

2008-05-12 Thread Jouni K . Seppänen
Neal Becker [EMAIL PROTECTED] writes:

 To produce a batch of pdfs, I'm using:
[...]
 Works, but causes my display to flash, I think each time either close() or
 figure() is called (not sure which).  Any better way?

To avoid opening a window at all, use a non-interactive backend by
putting something like the following at the start of your script,
_before_ importing anything else:

import matplotlib
matplotlib.use('pdf')

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] getting the min and max values of an axis for plotting

2008-05-12 Thread Jouni K . Seppänen
Johann Cohen-Tanugi
[EMAIL PROTECTED] writes:

 I have a function, which I am plotting. I want to add a line positioned 
 at, say, the mean of the function, so I want to do plot([x,x],[y0,y1]).

Try axvline(x).

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] tkinter segv under opensuse 10.3

2008-05-12 Thread Malte Marquarding
Hi,

I had a look through the archives but couldn't find an answer to this.
Using the tkagg backend (agg is fine) I get a segmentation fault  
doing a simple plot.
gdb returns the following:

362   Point* ll_api() {return _ll;}
Current language:  auto; currently c++
(gdb) bt
#0  0xb6fc1bac in PyAggImagePhoto (clientdata=0x0, interp=0x87a9430,  
argc=5,
 argv=0xbf97fc9c) at src/_transforms.h:362
#1  0xb712ea5c in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so
#2  0xb712ff05 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so
#3  0xb7131015 in Tcl_EvalObjv () from /usr/lib/libtcl8.4.so
#4  0xb73d34a6 in ?? () from /usr/lib/python2.5/lib-dynload/_tkinter.so
snip

This is matplotlib-0.91.2, python 2.5 on linux (opensuse 10.3)


Cheers,
Malte.

-
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] closing windows matplotlib and tkinter

2008-05-12 Thread KURT PETERS
I have a simple window to open a file that the data is then used to make a 
graph:
The code for that part is:
=code
window = Tkinter.Tk()
#window.withdraw()  -- not sure what this does
window.title('hello world')
w = Tkinter.Label(window,text=hello, again)
w.pack
menubar = Tkinter.Menu(window)
mfile = Tkinter.Menu(menubar, tearoff = 0)
mfile.add_command(label=Open, command=callback)
mfile.add_command(label=Save, command=callback)
menubar.add_cascade(label=File, menu=mfile)
window.config(menu=menubar)
errmsg = 'Error!'

of_But = Tkinter.Button(window, text= Open File, command=callback)
of_But.pack()
#Button(text='Quit', command=(lambda: showerror('Sure you want to 
quit?', errmsg))).pack(fill=X)
q = Tkinter.Button(window, text=Quit, fg=red, command=window.quit)
q.pack()

window.mainloop()


I then create a map :
=code=
m1 = 
Basemap(llcrnrlon=-119,llcrnrlat=22,urcrnrlon=-64,urcrnrlat=49,\
 
projection='lcc',lat_1=33,lat_2=45,lon_0=-95,resolution='l')
shp_info = 
m1.readshapefile(r'C:\Python25\Lib\basemap-0.9.9.1\examples\citiesx020','states',drawbounds=True)

ax=p.gca()
seqnum={}
criteriatodisplay=[]
names={}
for seq, shapedict in enumerate(m1.states_info):
if int(shapedict['POP_2000'])15:
seqnum[seq]=shapedict['NAME']
criteriatodisplay.append(seq)
m1.drawcoastlines()
m1.fillcontinents()
m1.drawcountries()
m1.drawstates()
m1.drawparallels(p.arange(25,65,4),labels=[1,0,0,0])
m1.drawmeridians(p.arange(-120,-40,4),labels=[0,0,0,1])
p.show()
==

But when I click on quit, I get this error:

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.

It's not that big of a deal since I'm quitting anyways, but does anyone know 
how to fix this?
Kurt



-
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Non-linear Regression to a Histogram

2008-05-12 Thread Alan Jackson
I have an example of fitting distributions to bus arrival times using
'R' that may be helpful. I wanted to calculate the latest time I could
arrive at the bus stop and have a better than 95% chance of catching
the bus. I tend to use R and Scipy whereever each is strongest.

http://www.oplnk.net/~ajackson/software/
http://www.oplnk.net/~ajackson/software/BusStats.R

On Sun, 11 May 2008 18:49:58 -0500
glenn andrews [EMAIL PROTECTED] wrote:

 I have been working on a similar problem related to finance.  What I 
 have done is call the R statistical software from Python and then use 
 matplotlib for graphing within Python
 
 I use Python2.4,  the R statistical package, and a Python package 
 called rpy which interfaces to R from Python
 
 LINKs:
 http://rpy.sourceforge.net/
 http://www.r-project.org/
 
 My tendency is to submit the data to R which does the statistical 
 calculations, return the results to Python, and then use Matplotlib to 
 plot.  Keep in mind that R also has good plotting capabilities and you 
 might just go with that solution. 
 
 

 ###
 
 
 Eric Firing wrote:
 
 You might get a good answer here (although I don't have it), but be 
 aware that your question relates to math, not plotting, so it is not 
 really a matplotlib question.  You need nonlinear least-squares.  Look 
 in scipy, and try the amazing Google.
 
 Eric
 
 Adrian Price-Whelan wrote:
   
 
 Hey guys -
 
 I'm working on a Histogram of pixel values from an astronomical image  
 that looks like a Gaussian curve and then polynomial decay.  I'm  
 trying to figure out a way to fit a Gaussian regression to the  
 histogram, but can't find any documentation on this. thanks!
 
 -adrian
 
 
 
 -
 This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
 Don't miss this year's exciting event. There's still time to save $100. 
 Use priority code J8TL2D2. 
 http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
   
 
 
 
 -
 This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
 Don't miss this year's exciting event. There's still time to save $100. 
 Use priority code J8TL2D2. 
 http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
---
| Alan K. Jackson| To see a World in a Grain of Sand  |
| [EMAIL PROTECTED]  | And a Heaven in a Wild Flower, |
| www.ajackson.org   | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake   |
---

-
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users