On Sun, Oct 4, 2009 at 10:57 PM, Jae-Joon Lee <lee.j.j...@gmail.com> wrote:
> MPL, by default, does not do any clipping. So, i'm not sure why the
> extent of the circle matters (I think even the bbox_inches option does
> not take care of that) . Everything should be fine as far as you
> create a figure in an appropriate size. Changing the suplotplot
> parameters (or something similar) is not your option?

> If possible, can you post a simplified version of your code that
> demonstrate the problem?

Sure:
-------- bounds.py ---------
#!/usr/bin/python
import matplotlib
import pylab

if __name__ == '__main__':
    pylab.clf()
    ax = pylab.axes([0,0,1,1])
    ax.add_line(matplotlib.lines.Line2D((2, 5), (0.75, 6)))
    ax.add_patch(matplotlib.patches.Arc((2, 0), 1.5, 1.5, 0.0, 0,
180.0, fill=False))
    ax.axis('equal')
    pylab.savefig("fig-a.pdf", bbox_inches='tight', pad_inches=0)
--------------------------------

What this does is make a stupid little picture of a hemi-circle and
and line going off somewhere. At any rate, the y dimensions of this
image are something like [-0.75, 6], while I'd expect it to be [0, 6]
- the 'imaginary' lower half of the circle is being used to compute
the final axes size. The y dimensions do no change if I choose
ax.axis('tight')

While I'm at it, I might as well as about image dimensions vs. axes limits.

If I change ax.axis('equal') manually to the correct bounding box of
the visible stuff (i.e. ax.axis([1.25, 5, 0, 6])), I then get an image
that is distorted, presumably to fit some pre-set aspect ratio. Is
there a way to fix this, too? I guess what I'd like is a way to say:
"When you save or render this image, set the output image dimensions
to be appropriate to aspect ratio x (usually 1:1 for me) and the
current axis setting"

I've used matplotlib for more than a few projects, but this aspect of
it has eluded me.

Thanks for all your help,
Jason

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to