File tree Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 1
- 2009-03-20 Add AuxTransformBox in offsetbox.py to support some transformation.
2
- anchored_text.py example is enhanced and renamed
1
+ 2009-03-25 Make contour and contourf handle nan in their Z argument. - EF
2
+
3
+ 2009-03-20 Add AuxTransformBox in offsetbox.py to support some transformation.
4
+ anchored_text.py example is enhanced and renamed
3
5
(anchored_artists.py). - JJL
4
6
5
7
2009-03-20 Add "bar" connection style for annotation - JJL
Original file line number Diff line number Diff line change 3
3
origin = 'lower'
4
4
#origin = 'upper'
5
5
6
- test_masking = False # There is a bug in filled contour masking.
6
+ # The following controls only interior masking.
7
+ test_masking = False # There is a bug in filled contour masking with
8
+ # interior masks.
7
9
8
10
if test_masking :
9
11
# Use a coarse grid so only a few masked points are needed.
30
32
Z [0 ,0 ] = 0
31
33
Z = ma .array (Z , mask = badmask )
32
34
35
+ nr , nc = Z .shape
36
+
37
+ # put NaNs in one corner:
38
+ Z [- nr // 6 :, - nc // 6 :] = nan
39
+ # contourf will convert these to masked
40
+
41
+
42
+ Z = ma .array (Z )
43
+ # mask another corner:
44
+ Z [:nr // 6 , :nc // 6 ] = ma .masked
45
+
46
+
33
47
# We are using automatic selection of contour levels;
34
48
# this is usually not such a good idea, because they don't
35
49
# occur on nice boundaries, but we do it here for purposes
48
62
origin = origin ,
49
63
hold = 'on' )
50
64
51
- title ('Nonsense' )
65
+ title ('Nonsense (with 2 masked corners) ' )
52
66
xlabel ('word length anomaly' )
53
67
ylabel ('sentence length anomaly' )
54
68
72
86
colors = ('k' ,),
73
87
linewidths = (3 ,),
74
88
origin = origin )
75
- title ('Listed colors' )
89
+ title ('Listed colors (with 2 masked corners) ' )
76
90
clabel (CS4 , fmt = '%2.1f' , colors = 'w' , fontsize = 14 )
77
91
colorbar (CS3 )
78
92
Original file line number Diff line number Diff line change @@ -756,6 +756,7 @@ def _contour_args(self, *args):
756
756
x ,y ,z = self ._check_xyz (args [:3 ])
757
757
else :
758
758
raise TypeError ("Too many arguments to %s; see help(%s)" % (fn ,fn ))
759
+ z = ma .masked_invalid (z , copy = False )
759
760
self .zmax = ma .maximum (z )
760
761
self .zmin = ma .minimum (z )
761
762
if self .logscale and self .zmin <= 0 :
You can’t perform that action at this time.
0 commit comments