aradand
2015-05-20 11:43:54 UTC
I'm trying to plot an image on top of a Figure, but imshow seems to always
distort the size of the axes. What I want is that the lower part of the top
image stay always in the same position, for any image height
This minimal example shows my issue
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_axes([0.1, 0, 1, 1])
# Top figure aligned with the bottom figure
# keeping the same width (?)
ax2 = fig.add_axes([0.1, 1, 1, 1])
ax2.set_xticks([])
# Depending on the number of rows or columns
# the top image will be moved further to the top
# or will be stretched if rows > columns
# I dont know how to control this to stay always
# with the same separation with respect
# to the bottom figure and keeping the same width
# (so the frame is the same width than the bottom figure)
im = np.random.rand(10, 30)
ax2.imshow(im)
plt.plot()
If it is possible to
I would prefer to avoid using subplots or grid, since I have already
specified a lot of things using the add_axes method.
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Fixing-axes-for-imshow-plot-on-top-of-a-figure-tp45579.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
distort the size of the axes. What I want is that the lower part of the top
image stay always in the same position, for any image height
This minimal example shows my issue
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_axes([0.1, 0, 1, 1])
# Top figure aligned with the bottom figure
# keeping the same width (?)
ax2 = fig.add_axes([0.1, 1, 1, 1])
ax2.set_xticks([])
# Depending on the number of rows or columns
# the top image will be moved further to the top
# or will be stretched if rows > columns
# I dont know how to control this to stay always
# with the same separation with respect
# to the bottom figure and keeping the same width
# (so the frame is the same width than the bottom figure)
im = np.random.rand(10, 30)
ax2.imshow(im)
plt.plot()
If it is possible to
I would prefer to avoid using subplots or grid, since I have already
specified a lot of things using the add_axes method.
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Fixing-axes-for-imshow-plot-on-top-of-a-figure-tp45579.html
Sent from the matplotlib - users mailing list archive at Nabble.com.