Hi List,

How can I make a plot have the same width as an image? The image (and
contour) have a fixed aspect ratio defined by the data. Now I'd like to
plot something under that image, with the same width.

I think this is trivial. I think I've done this in the past. But I
cannot find the code. Searching online and with experiments I've looked
into "sharex", and tried using "extent" and the bbox,
ax.transData.inverted(), etc. but I have not had any success, hence my
post here.

The following code demonstrates the problem. The 2nd axis is wider than
the first that contains the image.

Thanks,

  -k.
  

fig = plt.figure(1)
fig.clf()

data = np.random.random((3,3))
xaxis = np.arange(0,3)
yaxis = np.arange(0,3)

ax = fig.add_subplot(211)
im = ax.imshow(data, interpolation='none')
c = ax.contour(xaxis, yaxis, data, colors='k')

ax2 = fig.add_subplot(212)

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to