What are you trying to achieve as the output? An image with no white
Yes, and no edge, but one that replaces that white space with my figure.
in other words, if what is going on is that my figure w/ the white space
is what is 3600x2400, how do I get the full 3600x2400 to be my figure? (I
don?t care if it puts white space around that because I figured out an
?alternative? way to get rid of that). But mostly, I?d just like to
understand what?s going on, because what?s happening now makes absolutely
no sense to me whatsoever.
`bbox_inches=tight` changes the size of the figure to get rid of white
space around it. Prob not what you really want.
OK, so that may be the problem: what?s the ?proper? way to ?get rid of? the
white space, module what I said above.
Drilling down into `canvas` shouldn?t really be necessary.
I?m all ears.
What is `PLB`? etc?
import pylab as PLB
This will get you pretty close if you just want an image w/ no white
space. But I?m not 100% sure that every pixel has been preserved?
import matplotlib.pyplot as plt
import numpy as np
im = np.floor(np.random.rand(3601,2401)*100)
fig, ax = plt.subplots(figsize = (2401/300, 3601/300), dpi=300)
# turn off axis and labels
# fill the figure
ax.set_position([0., 0., 1., 1.])
Ok, I?ll try that, thanks.
Hi\! I spent a good part of yesterday trying to figure this out on my own,
without success, so I'm posting\. I have a 3601x2401 pixel, 300 DPI figure
I export to a png using print\_figure; here's sample code:
PLB\.imshow\(rslt\) \# rslt is a 3601x2401 int\-valued array
curfig = PLB\.Figure
fig = PLB\.gcf\(\)
\# next three lines are in my code; don't seem relevant, but I include them in case they are
ax = fig\.gca\(\)
fig\.canvas\.print\_figure\(fn \+ '\.png',
pad\_inches=\-1\.0 / 72\)
The resulting png is neither the right number of pixels by pixels, nor the right number of inches by incheses; what's more the resulting png differs depending on whether I use imshow or matshow \(which I also tried\)\.
What's going on, and how do I "fix" it? \(If I really am getting the full resolution figure, despite what the png is telling me are the pixel counts, why are the physical dimensions off, and why is the png telling me that the pixel counts are different? If it has something to do with compression, is there some undocumented way to say "no compression" and will that have the desired effect?\)
Matplotlib\-users mailing list
Matplotlib\-users at python\.org
-------------- next part --------------
An HTML attachment was scrubbed...
On Fri, Oct 20, 2017 at 3:00 PM Jody Klymak <jklymak at uvic.ca> wrote:
On 20 Oct 2017, at 14:38 PM, David Goldsmith <eulergaussriemann at gmail.com> > wrote: