Closed
Description
Bug summary
When zooming in on a plt.contour
plot, mpl sometimes generates extra false contour lines.
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
# prepare the data
delta = 0.025
x = np.arange(-1.0, 1.0, delta)
y = np.arange(-1.0, 1.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = np.exp(-(X ** 2) - Y ** 2)
Z2 = np.exp(-((X - 1) ** 2) - (Y - 1) ** 2)
Z = (Z1 - Z2) * 2
# the actual plotti
plt.contour(X, Y, Z, levels=[1.1], colors="red")
plt.show()
Actual outcome
Zoomed in, whoops:
Expected outcome
Operating system
Ubuntu
Matplotlib Version
3.5.0.dev1603+gec126b0175
Matplotlib Backend
Qt5Agg
Python version
3.9.7
Jupyter version
No response
Other libraries
No response
Installation
pip
Conda channel
No response