I just realized that I replied to this off-list. Sending back out to the
entire list. (Sorry for the duplicate e-mail Christoph!)
On Oct 18, 2013 6:11 AM, "Christoph Groth" <christ...@grothesque.org> wrote:
> Joe, thank you very much for your reply. So the "figsize" of a
> matplotlib plot is the physical size of the region between the axes
> where the data is shown?
No, your first assumption was correct. "figsize" refers to the size of the
whole figure.
What I meant to do in that example was abuse the fact that matplotlib will
happily add things beyond the figure boundaries. You can then abuse the
"bbox_inches" kwarg to savefig to show everything, while keeping the size
of the "data area" between the axes boundaries the same as the figsize.
My example there is actually completely wrong. I meant to do this:
import numpy as np
import matplotlib.pyplot as plt
dpi = 80
data = np.random.random((100, 100))
height, width = np.array(data.shape, dtype=float) / dpi
fig = plt.figure(figsize=(width, height), dpi=dpi)
ax = fig.add_axes([0, 0, 1, 1])
ax.imshow(data, interpolation='none')
fig.savefig('test.png', bbox_inches='tight')
At any rate, I'm not quite sure if that's actually what you wanted, but
it's a useful trick in cases like this.
------------------------------------------------------------------------------
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