[Matplotlib-users] PNG images and image area

2010-02-23 Thread Bruce Ford
I'm attempting to output an image with a predictable bounding box so
that it can be placed into a KML document and be correctly
georeferenced.

Essentially I need a PNG that has NO labeling and the size of the
image be exactly the size of the plot bounding box and no more, no
less.

I can get exactly what I want with the top and bottom of the image with:

fig.add_axes((0,0,1,1)

However, I'm still left with undesired space on the left and right.
How can I bring the left and right edges of the bounding box to match
the image width?

Also, this might be a candidate for a handy function for
pyplot.figure().  This could be very useful for anyone needing to make
KML-friendly figures.

Thanks for any ideas!

Bruce
---
Bruce W. Ford
Clear Science, Inc.
br...@clearscienceinc.com
http://www.ClearScienceInc.com
Phone/Fax: 904-379-9704
8241 Parkridge Circle N.
Jacksonville, FL  32211
Skype:  bruce.w.ford
Google Talk: for...@gmail.com

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PNG images and image area

2010-02-23 Thread Friedrich Romstedt
The question has been answered I think in the thread
Graph gains a blank space at the right hand side
just some seconds ago.

Am I wrong?

Friedrich

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PNG images and image area

2010-02-23 Thread Jae-Joon Lee
It is best to create a figure of a right size in the first place.

If this cannot be done, try something like below.

dpi = 80
fig=figure(1, dpi=dpi)
ax = axes((0,0,1,1))
ax.set_aspect(1)

from matplotlib.transforms import TransformedBbox, Affine2D
w, h = fig.get_size_inches()
bbox = TransformedBbox(ax.bbox,
fig.transFigure.inverted()+Affine2D().scale(w, h))

savefig(a.png, bbox_inches=bbox, dpi=dpi)

Note that the size of the output will be different from the original
figure size.
Regards,

-JJ


On Tue, Feb 23, 2010 at 3:37 PM, Bruce Ford br...@clearscienceinc.com wrote:
 I'm attempting to output an image with a predictable bounding box so
 that it can be placed into a KML document and be correctly
 georeferenced.

 Essentially I need a PNG that has NO labeling and the size of the
 image be exactly the size of the plot bounding box and no more, no
 less.

 I can get exactly what I want with the top and bottom of the image with:

 fig.add_axes((0,0,1,1)

 However, I'm still left with undesired space on the left and right.
 How can I bring the left and right edges of the bounding box to match
 the image width?

 Also, this might be a candidate for a handy function for
 pyplot.figure().  This could be very useful for anyone needing to make
 KML-friendly figures.

 Thanks for any ideas!

 Bruce
 ---
 Bruce W. Ford
 Clear Science, Inc.
 br...@clearscienceinc.com
 http://www.ClearScienceInc.com
 Phone/Fax: 904-379-9704
 8241 Parkridge Circle N.
 Jacksonville, FL  32211
 Skype:  bruce.w.ford
 Google Talk: for...@gmail.com

 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users