-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
plt.contour levels parameter don't work as intended if receive a single int #11913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yeah, this is a bit funky. It works fine if you do: I would say that |
Milestoning 3.1, since this behaviour has been present since at least 2.0.2 |
I think @efiring changed some of this for 3.0 already. |
Well, yes. Its worse (?) on master:
|
I see where the problem is. |
Bug report
Bug summary
The official documentation (https://matplotlib.org/api/_as_gen/matplotlib.pyplot.contour.html) says that the parameter
levels
of thepyplot.contour
function is an integer will be calculated and shown a number of contours equal to the number passed as a parameter.The reality of the facts, however, is that the outline associated with the past value is plotted.
Code for reproduction
I used the contour demo example from https://matplotlib.org/gallery/images_contours_and_fields/contour_demo.html#contour-demo adding the
levels
parameter as int.Actual outcome
Expected outcome
According to official documentation I should expect 5 outlines and not the boundary associated with the value 5.

The expected output was obtained by modifying the penultimate line in:
Matplotlib version
print(matplotlib.get_backend())
): Qt5Aggnumpy
All libraries have been installed via the official ArchLinux repository
The text was updated successfully, but these errors were encountered: