Closed
Description
Bug report
Bug summary
I am trying to make a plot with sharex options. There are two subplots, one is just a line plot, and the other is made with pcolormesh, with a colorbar. The use of the colorbar, however, totally messed up the position of the plot from pcolormesh.
Code for reproduction
# Paste your code here
#
#
import matplotlib.pyplot as plt
import numpy as np
plt.close('all')
fig,axes=plt.subplots(2,1,sharex=True)
ax = axes[0]
x = np.linspace(0, 100, 100)
ax.plot(x)
data = np.random.random((50, 100))
ax = axes[1]
plt2=ax.pcolormesh(data)
plt.colorbar(plt2)
plt.show()
Expected outcome
Something like the following, but with a colorbar on the right of the corresponding image.
Matplotlib version
- Operating system: MacOSX
- Matplotlib version: 2.2.2
- Matplotlib backend (
print(matplotlib.get_backend())
): - Python version: 3.6
- Jupyter version (if applicable):
- Other libraries:
matplotlib was installed via Macport
Metadata
Metadata
Assignees
Labels
No labels