Re: [matplotlib-devel] _transform limitations

2006-07-31 Thread Eric Firing
John,

I will respond to the more philosophical parts of your message later.

I have committed changes to _transforms.* and transforms.py along the 
lines of your suggestions for a quick improvement to the ease of drawing 
with offsets.


> The best way may be for the extension code to provide a shallowcopy
> method and require derived transform classes to implement it.  All
> references will be preserved, but a new object will be created.
> 
> We only need this for SeparableTransformation and
> NonseparableTransformation but the methods will also have to be
> defined virtually in the base classes.
> 
> We have to think about what should be preserved in the shallow
> copies.  For the use case at hand, we want to preserve the references
> to the values but not the offset transform.
> 
I think I got this right--or at least as right as the existing deepcopy 
methods--but it would be good if you, or another c++ wizard, could take 
a look.  The way I have it seems to work as intended, but testing has 
been light, and I don't really know c++.  I have never written any from 
scratch, only modified existing code.

> I'm not so sure that deepcopy is really needed.  I can't think of a
> use case off hand.

I think it is needed for pickling, but I suspect that the screwiness of 
the objects that the _transforms module produces would prevent pickling 
in any case.  Other than that, I don't see any point in the deepcopy 
methods, or the corresponding (and redundant) deepcopy functions in 
transforms.py.  I marked with comments a block that I think should be 
excised from transforms.py.

The convenience function I came up with is transforms.offset_copy:

def offset_copy(trans, fig=None, x=0, y=0, units='inches'):
 '''
 Return a shallow copy of a transform with an added offset.
   args:
 trans is any transform
   kwargs:
 fig is the current figure; it can be None if units are 'dots'
 x, y give the offset in units of 'inches' or 'dots'
 units is 'inches' or 'dots'
 '''
 newtrans = trans.shallowcopy()
 if units == 'dots':
 newtrans.set_offset((x,y), identity_transform())
 return newtrans
 if not units == 'inches':
 raise ValueError('units must be dots or inches')
 if fig is None:
 raise ValueError('For units of inches a fig kwarg is needed')
 tx = Value(x) * fig.dpi
 ty = Value(y) * fig.dpi
 newtrans.set_offset((0,0), translation_transform(tx, ty))
 return newtrans



Minimal testing and illustration of the use of offsets is now in 
examples/transoffset.py.  It includes cartesian and polar coordinates.

Eric

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] [ 1530104 ] Slider should grab mouse

2006-07-31 Thread John Hunter
> "Bill" == Bill Baxter <[EMAIL PROTECTED]> writes:

Bill> Ok.  Such a pain though...  Are whole files acceptable
Bill> instead of diffs?  It's relatively easy to do a windiff or

Multiple contributions per patch are fine, just do like you did and
list what is in them.  If there is an objection to part of the patch,
you may be asked to resubmit w/o the controversial parts, but if all
the changes look good the whole thing can go in.  And we prefer svn
diffs over individual files.

Ken, would you like to be added to the devel list to handle some of
these patches.  Just email me your sf id if so.

JDH

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] _transform limitations

2006-07-31 Thread John Hunter
> "Eric" == Eric Firing <[EMAIL PROTECTED]> writes:
Eric> return newtrans if not units == 'inches': raise
Eric> ValueError('units must be dots or inches') if fig is None:

This all looks great and I like the interface.  My only suggestions is
to add points (1/72. inches) since this is commonly used throughout
matplotlib, is easy, and is the most common distance metric used in
graphics.

Eric> Minimal testing and illustration of the use of offsets is
Eric> now in examples/transoffset.py.  It includes cartesian and
Eric> polar coordinates.
 
Excellent!

JDH


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] imshow with PS backend

2006-07-31 Thread JIM MacDonald
> I'll look into this soon. I'm hesitant to add another rc option, maybe we can
> consider using these settings as the defaults. I'll post again after I have
> had a chance to play with it.
Defaulting to lossless FlateEncode compression seems like a good idea,
if the file is too big you can always run another distill cycle after
wards manually.

Another possibility would be to set the option based on the format of
the image loaded (I'm  sure I read somewhere that it is planned to
support formats other than PNG). ie FlateEncode for GIF's and PNG's
and DCTEncode for JPEG's.

> The resolution for Postscript is 72 dpi, and I'm not sure this can be changed.
> Would you send me an example postscript file along with the original png?
Sure,
http://jimmacdonald.co.uk/matplotlib/image.png
http://jimmacdonald.co.uk/matplotlib/image.eps
http://jimmacdonald.co.uk/matplotlib/image.py

image.py generates image.eps from image.png. image.png is simple
enough for ps2pdf not to use DCT encoding. Looking at the postscript
shows that the image has resolution of 335x230 compared to the
original of 318x301.

JIM
---

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] imshow with PS backend

2006-07-31 Thread Darren Dale
On Monday 31 July 2006 09:32, JIM MacDonald wrote:
> > The resolution for Postscript is 72 dpi, and I'm not sure this can be
> > changed. Would you send me an example postscript file along with the
> > original png?
>
> Sure,
> http://jimmacdonald.co.uk/matplotlib/image.png
> http://jimmacdonald.co.uk/matplotlib/image.eps
> http://jimmacdonald.co.uk/matplotlib/image.py
>
> image.py generates image.eps from image.png. image.png is simple
> enough for ps2pdf not to use DCT encoding. Looking at the postscript
> shows that the image has resolution of 335x230 compared to the
> original of 318x301.

I don't think this is a problem with the postscript backend. You're rescaling 
the image in your script. Try something like this: 

from pylab import *

rc('text', usetex=True)
rc('ps', usedistiller="xpdf")

figure(1,figsize=(6, 4))
im=imread('image.png')
imshow(im,interpolation='nearest')#,extent=[0.98, 20, 0.01, 0.5])
#axis('normal');
savefig('image.eps')

Darren

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] imshow with PS backend

2006-07-31 Thread Darren Dale
On Monday 31 July 2006 09:32, JIM MacDonald wrote:
> > I'll look into this soon. I'm hesitant to add another rc option, maybe we
> > can consider using these settings as the defaults. I'll post again after
> > I have had a chance to play with it.
>
> Defaulting to lossless FlateEncode compression seems like a good idea,
> if the file is too big you can always run another distill cycle after
> wards manually.
>
> Another possibility would be to set the option based on the format of
> the image loaded (I'm  sure I read somewhere that it is planned to
> support formats other than PNG). ie FlateEncode for GIF's and PNG's
> and DCTEncode for JPEG's.

[...]

> Sure,
> http://jimmacdonald.co.uk/matplotlib/image.png
> http://jimmacdonald.co.uk/matplotlib/image.eps
> http://jimmacdonald.co.uk/matplotlib/image.py
>
> image.py generates image.eps from image.png. image.png is simple
> enough for ps2pdf not to use DCT encoding. Looking at the postscript
> shows that the image has resolution of 335x230 compared to the
> original of 318x301.

Would you post an example where the ps2pdf flags make a big difference on the 
output? I just tried with the above png, but I cant tell the difference 
between the results with/without the new flags.

Darren

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] [ 1530104 ] Slider should grab mouse

2006-07-31 Thread Bill Baxter
Great.  Thanks John.
There was one other thing I forgot to mention.
I added two lines (+comment) in the backend_wx.py to select the
Pan/Zoom tool by default.
If you don't like that, then obviously just leave those lines out,
But I find that pan/zoom is what I want to do 90% of the time, and
zoom is the other 10%.  "No tool" is what I want pretty much 0% of the
time (is there some use for no-tool mode that I'm missing?)

--bb

On 7/31/06, John Hunter <[EMAIL PROTECTED]> wrote:
> > "Bill" == Bill Baxter <[EMAIL PROTECTED]> writes:
>
>Bill> Ok.  Such a pain though...  Are whole files acceptable
>Bill> instead of diffs?  It's relatively easy to do a windiff or
>
> Multiple contributions per patch are fine, just do like you did and
> list what is in them.  If there is an objection to part of the patch,
> you may be asked to resubmit w/o the controversial parts, but if all
> the changes look good the whole thing can go in.  And we prefer svn
> diffs over individual files.
>
> Ken, would you like to be added to the devel list to handle some of
> these patches.  Just email me your sf id if so.
>
> JDH
>

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] imshow with PS backend

2006-07-31 Thread Gael Varoquaux
On Mon, Jul 31, 2006 at 10:01:23AM -0400, Darren Dale wrote:
> Would you post an example where the ps2pdf flags make a big difference on the 
> output? I just tried with the above png, but I cant tell the difference 
> between the results with/without the new flags.

Last image of http://scipy.org/GaelVaroquaux, the example script. You
can also have a look at the "pylab2pdf2 script, where I use
environmental variables to get a proper behaviour from GS and avoid this
problem.

-- 
Gaël

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] imshow with PS backend

2006-07-31 Thread Darren Dale
On Monday 31 July 2006 10:05, Gael Varoquaux wrote:
> On Mon, Jul 31, 2006 at 10:01:23AM -0400, Darren Dale wrote:
> > Would you post an example where the ps2pdf flags make a big difference on
> > the output? I just tried with the above png, but I cant tell the
> > difference between the results with/without the new flags.
>
> Last image of http://scipy.org/GaelVaroquaux, the example script. You
> can also have a look at the "pylab2pdf2 script, where I use
> environmental variables to get a proper behaviour from GS and avoid this
> problem.

I see. Thanks for pointing this out and providing the solution. The flags you 
suggested are passed to ps2pdf as of svn 2639.

Darren

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] imshow with PS backend

2006-07-31 Thread Gael Varoquaux
On Mon, Jul 31, 2006 at 10:19:46AM -0400, Darren Dale wrote:
> I see. Thanks for pointing this out and providing the solution. The flags you 
> suggested are passed to ps2pdf as of svn 2639.

Great ! Thanks.

I like open source software so much because of these little details
:->.

-- 
Gaël

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] imshow with PS backend

2006-07-31 Thread JIM MacDonald
> Would you post an example where the ps2pdf flags make a big difference on the
> output? I just tried with the above png, but I cant tell the difference
> between the results with/without the new flags.
http://jimmacdonald.co.uk/matplotlib/MPD_SinPulse_g0.500.png

JIM
---

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] imshow with PS backend

2006-07-31 Thread JIM MacDonald
> I don't think this is a problem with the postscript backend. You're rescaling
> the image in your script. Try something like this:
>
> from pylab import *
>
> rc('text', usetex=True)
> rc('ps', usedistiller="xpdf")
>
> figure(1,figsize=(6, 4))
> im=imread('image.png')
> imshow(im,interpolation='nearest')#,extent=[0.98, 20, 0.01, 0.5])
> #axis('normal');
> savefig('image.eps')

I just tried that and it still rescales the image, this time to
243x230. I've found I can use the figsize kwarg to control the
resolution of the embedded image, but of course this means I can't
have the figure the size I want it.

JIM
---

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] imshow with PS backend

2006-07-31 Thread John Hunter
> "JIM" == JIM MacDonald <[EMAIL PROTECTED]> writes:

JIM> My second problem involved the resolutions of the image.  I'd
JIM> like to preserve the resolution of my image in the PS output,
JIM> but I can't figure out how to stop the image being resized
JIM> and interpolated.  Obviously you need to do this for the


There are two kinds of images in matplotlib -- AxesImage and
FigureImage.  By definition, the AxesImage is interpolated to fit into
the Axes box.  You can control the aspect ratio of the interpolation,
but it will be interpolated.  FigureImage, on the other hand, performs
a pixel dump to the postscript canvas at the location you tell it to
-- see examples/figimage_demo.py.  It should like you are more
interested in the latter.

If the figure image doesn't work for you, describe your use-case in
some detail and why neither work and we'll see if we can accommodate
it.

JDH

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] wx-style layout engine for matplotlib: mplsizer

2006-07-31 Thread Andrew Straw
Hi Ken,

Thanks for your comments.

Ken McIvor wrote:

>1. It appears that as_sizer_element() uses the _axes_sizer_elements  
>dictionary to cache MplAxesSizerElement instances.  Using a  
>WeakKeyDictionary from the "weakref" module instead of a regular  
>dictionary may be necessary to allow the garbage collection of the  
>MplAxesSizerElements when their associated Axes gets GC'd.
>  
>
I'll check into this.

>2. Convenience MplBoxSizer subclasses that let you omit the "orient"  
>keyword might be nice:
>
> class MplHBoxSizer(MplBoxSizer):
> def __init__(self):
> MplBoxSizer.__init__(self, orientation='vertical')
>  
>
I was thinking I want an exact a replica of the wx API as possible,
simply so my feeble mind doesn't get (more) confused. Is there anything
like this in stock wx? I think it's a decent enough idea, but I'd rather
not cause namespace bloat. But, if you're really into it, let's do it.

>3. Couldn't you just drop mplsizer.py into the "matplotlib.toolkits"  
>virtual package?  Maybe you can't -- I'm pretty new to applied python- 
>eggery.
>  
>
I think this is possible, and I hope for not too much effort. This is
the result of historic accident and personal time-allocation issues.
Mplsizer started life as a private setuptools-ized package, and I'm not
spending my time to de-setuptools-ize software -- I see setuptools as
the way forward, not something (I will spend my time) to remove. I
understand that some people aren't too fond of setuptools, and to them,
I say, "patches welcome".

>4. I feel we should avoid the whole European/American spelling  
>problem that WX has.  Why not make both 'align_centre' and  
>'align_center' do the same thing?
>  
>
Same answer as to point 2...

>5. Why not use shorter names, with less redundancy? (e.g.  
>"matplotlib.toolkits.sizer", FigureSizer, Box, HBox, Grid, etc)
>  
>
Same answer as to point 2... (I'd be happy to drop the "Mpl" prefix,
though.)

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] wx-style layout engine for matplotlib: mplsizer

2006-07-31 Thread Christopher Barker
Andrew Straw wrote:
> I was thinking I want an exact a replica of the wx API as possible,

well, I'm a big fan of wx.Sizers, but we all know that they confuses folks.

Given that grid-like layouts are likely to be the most common with MPL, 
maybe just make a GridBagSizer, and forget the rest? All the other 
sizers are just a simplification of that anyway.

just my $0.2

Despite that small suggestion -- very nice work!

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel