forked from matplotlib/matplotlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New C++ contour code with corner_mask
- Loading branch information
1 parent
1fe5b9c
commit 27154d3
Showing
19 changed files
with
12,589 additions
and
1,215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Changed behaviour of contour plots | ||
`````````````````````````````````` | ||
|
||
The default behaviour of :func:`~matplotlib.pyplot.contour` and | ||
:func:`~matplotlib.pyplot.contourf` when using a masked array is now determined | ||
by the new keyword argument `corner_mask`, or if this is not specified then | ||
the new rcParam `contour.corner_mask` instead. The new default behaviour is | ||
equivalent to using `corner_mask=True`; the previous behaviour can be obtained | ||
using `corner_mask=False` or by changing the rcParam. The example | ||
http://matplotlib.org/examples/pylab_examples/contour_corner_mask.py | ||
demonstrates the difference. Use of the old contouring algorithm, which is | ||
obtained with `corner_mask='legacy'`, is now deprecated. | ||
|
||
Contour labels may now appear in different places than in earlier versions of | ||
matplotlib. | ||
|
||
In addition, the keyword argument `nchunk` now applies to | ||
:func:`~matplotlib.pyplot.contour` as well as | ||
:func:`~matplotlib.pyplot.contourf`, and it subdivides the domain into | ||
subdomains of exactly `nchunk` by `nchunk` quads, whereas previously it was | ||
only roughly `nchunk` by `nchunk` quads. | ||
|
||
The C/C++ object that performs contour calculations used to be stored in the | ||
public attribute QuadContourSet.Cntr, but is now stored in a private attribute | ||
and should not be accessed by end users. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Illustrate the difference between corner_mask=False and corner_mask=True | ||
for masked contour plots. | ||
""" | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
# Data to plot. | ||
x, y = np.meshgrid(np.arange(7), np.arange(10)) | ||
z = np.sin(0.5*x)*np.cos(0.52*y) | ||
|
||
# Mask various z values. | ||
mask = np.zeros_like(z, dtype=np.bool) | ||
mask[2, 3:5] = True | ||
mask[3:5, 4] = True | ||
mask[7, 2] = True | ||
mask[5, 0] = True | ||
mask[0, 6] = True | ||
z = np.ma.array(z, mask=mask) | ||
|
||
corner_masks = [False, True] | ||
for i, corner_mask in enumerate(corner_masks): | ||
plt.subplot(1, 2, i+1) | ||
cs = plt.contourf(x, y, z, corner_mask=corner_mask) | ||
plt.contour(cs, colors='k') | ||
plt.title('corner_mask = {}'.format(corner_mask)) | ||
|
||
# Plot grid. | ||
plt.grid(c='k', ls='-', alpha=0.3) | ||
|
||
# Indicate masked points with red circles. | ||
plt.plot(np.ma.array(x, mask=~mask), y, 'ro') | ||
|
||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+42.4 KB
lib/matplotlib/tests/baseline_images/test_contour/contour_corner_mask_False.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+53.9 KB
lib/matplotlib/tests/baseline_images/test_contour/contour_corner_mask_True.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.