[Matplotlib-users] mpl event backend; replotting a subplot (inefficient example improvement suggestions?)

2008-01-13 Thread Michael Frauens
I want to create an copy of a subplot in its unique figure after being clicked 
on in a figure with multiple subplots.  My code seems to work but I believe is 
inefficient and I'd like to understand how to use the event.* information more 
effectively in mpl.

I am successfully creating multiple subplots in a Figure using a class with 
lines for the data such as below.  I create a new figure for each instance of 
the class with 8 subplots in each.

exec(self.a.plot(glbl.%s0_pcdata,glbl.%s6_pcdata,glbl.%s0_pcdata,glbl.%s9_pcdata)%(color,color,color,color))

Furthermore I am using a mpl_connect to successfully capture and then validate 
which instance of the Figure for each of the unique subplots clicked on.
self.cid=self.canvas.mpl_connect('button_press_event', click)

I want to use the event to make an alternate sized plot of the subplot chosen.  
I can do this through some modest logic where I use the event information 
identify the instance clicked on.  A partial description of this logic is below 
- which seems to work properly. (a, b, c ... are subplots;  Instances are 
Kfigure, Yfigure etc...)
def click(event):
print 'you clicked x,y', event.x, event.y
print 'you clicked inaxes', event.inaxes
print 'string name of event', event.name
print 'figure canvas instance', event.canvas
if event.canvas==Kfigure.canvas:
print K canvas clicked
if event.canvas==Yfigure.canvas:
print Y canvas clicked
if event.inaxes==Kfigure.a:
print clicked inside subplot a of figure K 

However, to create an alternate new plot of the subplot I clicked, I have to 
create extended logic code (as above) for each of 40 subplots on 5 figures, and 
then reidentify the source data similar to the original exec line and shown 
below.  This seems inefficient.  Isn't there a more straightforward way to 
create the subplot clicked in its instances of new figure  // sorry if my 
terminology is inexact.. noob // A section of my suspected inefficient code is 
below.

Isn't there a way to use the event.inaxes, or other axes or data information to 
identify the data to be plotted and then subplot it?  Ideally this should 
include legend information that was created with the instance as well - that is 
not explicitly shown but I have done.  All I am really trying to do is enlarge 
one of the subplots for the user.  In the example in this email, I simply want 
to have a large Kfigure.a created.

I can get my code to work but it seems overly long and inefficient.

 if event.inaxes==Kfigure.a:
print clicked inside subplot a of figure K
color=K
bigroot=Tk.Tk()
bigroot.wm_title(title with big wm_title)
bigf=Figure(figsize=(3,6), dpi=72)
biga=bigf.add_subplot(111)
exec(biga.plot(glbl.%s0_pcdata,glbl.%s6_pcdata)%(color,color))
bigcanvas=FigureCanvasTkAgg(bigf, master=bigroot)
bigcanvas.show()
bigcanvas.get_tk_widget().pack(side=Tk.TOP,fill=Tk.BOTH,expand=1)


  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping-
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] Static linking problem on matplotlib eggs

2008-01-13 Thread Christopher Fonnesbeck
OK, I managed to build with the setupext.py list empty as you  
specified. However, for some reason, the resulting matplotlib egg  
*still* looks for dynamic libraries in /usr/local:

ImportError: dlopen(/Library/Python/2.5/site-packages/ 
matplotlib-0.98pre-py2.5-macosx-10.5-i386.egg/matplotlib/_path.so, 2):  
Library not loaded: /usr/local/lib/libpng12.0.dylib
  Referenced from: /Library/Python/2.5/site-packages/ 
matplotlib-0.98pre-py2.5-macosx-10.5-i386.egg/matplotlib/_path.so
  Reason: image not found

This is pretty bizarre.

On 12/01/2008, at 12:42 PM, Charlie Moad wrote:

 I just had to rebuild the OSX binary because a similar reason.  I
 forgot to change the basedir['darwin'] entry in setupext.py.  Around
 line 50.

 Change:
   'darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/ 
 local',
   '/usr', '/sw', '/usr/X11R6'],
 To:
   'darwin' : [],

 This will ensure you don't pick up shared libraries over the static
 ones since they are preferred by gcc.


-
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] matplotlib/__init__.py

2008-01-13 Thread Tom Johnson
I was looking at rc_params() and saw

if not os.path.exists(fname):
message = 'could not find rc file; returning defaults'
ret =  dict([ (key, tup[0]) for key, tup in defaultParams.items()])
warnings.warn(message)
return ret

Is this correct?  It seems that it returns a regular dictionary rather
than an instance of RcParams.

~tj

-
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