Jurgen,

I generally lurk on the list, but I'll speak up now since I have 
basically done what you are talking about.  I integrated MPL (TkAgg) 
into an existing application that resizes (PyRAF).

The path I chose isn't particularly pretty, but it does the job and 
sounds like it might be flexible enough for what you are doing.  I 
created an adapter class which wraps the MPL calls.  The adapter is what 
the existing application calls to make plots instead of calling MPL 
directly.  The adapter also keeps a normalized (0-1) copy of all plot 
data arrays (and any lines and other items).  When the canvas is 
resized, I go through all my lines (Line2D), patches (Rectangle), and 
text, and scale each based on the new canvas dimensions.  Then the new 
items are inserted directly into the Figure object, replacing the old 
values.  This resizes everything so that it is correct when redrawn.  I 
was initially concerned about performance, but the resizings are very 
smooth (thanks matplotlib!).  You could also enforce an aspect ratio 
this way.

I had to write this adapter not because of the resizing issue, but due 
to the constraints of the existing application with which I was 
working.  It did however make resizing easy.  As long as your plotted 
items are relatively simple (lines, patches, text), this works very 
well.  Using more complicated items like legends would not work as well 
unless you either allowed them to stay a static size or manually 
composed them of simpler objects.  In general, this idea is probably 
more work than John's DPI suggestions.

Chris

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

Reply via email to