Closed
Description
Bug report
Bug summary
When setting levels that span a wider range of values than the data set, contourf correctly picks the right colors to fill the areas between the contour lines. contour does not use the same colors.
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
levels = np.arange(-100, 100, 10)
x = np.loadtxt(open('x.txt','rb'),delimiter=',')
y = np.loadtxt(open('y.txt','rb'),delimiter=',')
z = np.loadtxt(open('z.txt','rb'),delimiter=',')
#CS = plt.contour(x, y, z, levels)
CS = plt.contourf(x, y, z, levels)
CB = plt.colorbar(CS)
plt.show()
The data is attached.
Actual outcome
When plotting with contour instead of contourf the colors range is scaled according to the maximum and minimum of the used data.
Expected outcome
I would expect contour to respect the range set in levels.
Matplotlib version
- Operating system: Debian unstable
- Matplotlib version: 2.1.1-2
- Matplotlib backend (
print(matplotlib.get_backend())
): TkAgg - Python version:
- Jupyter version (if applicable):
- Other libraries:
Installed from Debian package
Metadata
Metadata
Assignees
Labels
No labels