Hi there,
I'm plotting some images in latitude/longitude space. These are
images generated using the HEALpix method for discretizing the sphere,
but I have resampled them to a regular grid of phi, theta, and the
resultant image is contained in a variable img. This is a fully-self
contained snippet:
import matplotlib.figure
import matplotlib.backends.backend_agg
import numpy
from numpy import pi
img = numpy.random.random((800, 800))
fig = matplotlib.figure.Figure((10, 4.9))
ax = fig.add_subplot(1,1,1,projection='mollweide')
image = ax.imshow(img, extent=(-pi,pi,-pi/2,pi/2), clip_on=False, aspect=0.5)
cb = fig.colorbar(image, orientation='horizontal')
canvas = matplotlib.backends.backend_agg.FigureCanvasAgg(fig)
canvas.print_figure("hi.png")
This makes a very nice looking figure, basically as expected: a black
oval outline for the map projection with the image inside it, the
lat/lon axes identified, etc. What I'm running into here is that I
would like to fiddle with the size of the figure, to adjust the
whitespace and the position of the colorbar and so on, but any
adjustment to the height of the figure instantiation, for instance:
fig = matplotlib.figure.Figure((10, 4.9))
(and the rest unchanged) results in the black oval, the axes, but the
image content is completely blank. Is this a bug, or just a subtlety
I'm missing?
Thanks for any ideas!
Best,
Matt