-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use contourpy for quad contour calculations #22567
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
New algorithm keyword argument to contour and contourf | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
The contouring functions `~matplotlib.axes.Axes.contour` and | ||
`~matplotlib.axes.Axes.contourf` have a new keyword argument *algorithm* to | ||
control which algorithm is used to calculate the contours. There is a choice | ||
of four algorithms to use, and the default is to use ``algorithm='mpl2014'`` | ||
which is the same algorithm that Matplotlib has been using since 2014. | ||
|
||
Other possible values of the *algorithm* keyword argument are ``'mpl2005'``, | ||
``'serial'`` and ``'threaded'``; see the | ||
`ContourPy documentation <https://contourpy.readthedocs.io>`_ for further | ||
details. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
New external dependency ContourPy used for quad contour calculations | ||
-------------------------------------------------------------------- | ||
|
||
Previously Matplotlib shipped its own C++ code for calculating the contours of | ||
quad grids. Now the external library | ||
`ContourPy <https://github.com/contourpy/contourpy>`_ is used instead. There | ||
is a choice of four algorithms to use, controlled by the *algorithm* keyword | ||
argument to the functions `~matplotlib.axes.Axes.contour` and | ||
`~matplotlib.axes.Axes.contourf`. The default behaviour is to use | ||
``algorithm='mpl2014'`` which is the same algorithm that Matplotlib has been | ||
using since 2014. | ||
|
||
See the `ContourPy documentation <https://contourpy.readthedocs.io>`_ for | ||
further details of the different algorithms. | ||
|
||
.. note:: | ||
|
||
Contour lines and polygons produced by ``algorithm='mpl2014'`` will be the | ||
same as those produced before this change to within floating-point | ||
tolerance. The exception is for duplicate points, i.e. contours containing | ||
adjacent (x, y) points that are identical; previously the duplicate points | ||
were removed, now they are kept. Contours affected by this will produce the | ||
same visual output, but there will be a greater number of points in the | ||
contours. | ||
|
||
The locations of contour labels obtained by using | ||
`~matplotlib.axes.Axes.clabel` may also be different. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -607,10 +607,11 @@ | |
## * CONTOUR PLOTS * | ||
## *************************************************************************** | ||
#contour.negative_linestyle: dashed # string or on-off ink sequence | ||
#contour.corner_mask: True # {True, False, legacy} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This probably needs to be in the API change as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Support for |
||
#contour.corner_mask: True # {True, False} | ||
#contour.linewidth: None # {float, None} Size of the contour line | ||
# widths. If set to None, it falls back to | ||
# `line.linewidth`. | ||
#contour.algorithm: mpl2014 # {mpl2005, mpl2014, serial, threaded} | ||
|
||
|
||
## *************************************************************************** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the differences in clabel need to be mentioned here or are those usually small enough not to matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will mention it here.