On Thu, Oct 17, 2013 at 8:20 AM, Christoph Groth <c...@falma.de> wrote:
> Hello,
>
> I'm stuck trying to find a solution to the following problem.
>
> I'd like to show an array using imshow preserving the 1:1 aspect ratio
> of its pixels. At the same time, I would like the axes to fit around
> the image tightly.
>
> Is there some way to, for example, choose a certain figure width, and
> have the height chosen automatically to the optimal value?
>
> Thanks,
> Christoph
>
>
I particularly like using the figaspect() function:
http://matplotlib.org/api/figure_api.html?highlight=figaspect#matplotlib.figure.figaspect
The example usage there needs to be updated (it assumes the pylab mode
which imports everything in pyplot into the global namespace). But it
should be accessible like so:
import matplotlib.pyplot as plt
w, h = plt.figaspect(2)
It isn't perfect, but for its simplicity, it gets it mostly right.
Cheers!
Ben Root
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users