@@ -116,11 +116,31 @@ def test_contour_manual_labels(split_collections):
116
116
117
117
plt .figure (figsize = (6 , 2 ), dpi = 200 )
118
118
cs = plt .contour (x , y , z )
119
+
120
+ _maybe_split_collections (split_collections )
121
+
119
122
pts = np .array ([(1.0 , 3.0 ), (1.0 , 4.4 ), (1.0 , 6.0 )])
120
123
plt .clabel (cs , manual = pts )
121
124
pts = np .array ([(2.0 , 3.0 ), (2.0 , 4.4 ), (2.0 , 6.0 )])
122
125
plt .clabel (cs , manual = pts , fontsize = 'small' , colors = ('r' , 'g' ))
123
126
127
+
128
+ @pytest .mark .parametrize ("split_collections" , [False , True ])
129
+ @image_comparison (['contour_disconnected_segments' ],
130
+ remove_text = True , style = 'mpl20' , extensions = ['png' ])
131
+ def test_contour_label_with_disconnected_segments (split_collections ):
132
+ x , y = np .mgrid [- 1 :1 :21j , - 1 :1 :21j ]
133
+ z = 1 / np .sqrt (0.01 + (x + 0.3 ) ** 2 + y ** 2 )
134
+ z += 1 / np .sqrt (0.01 + (x - 0.3 ) ** 2 + y ** 2 )
135
+
136
+ plt .figure ()
137
+ cs = plt .contour (x , y , z , levels = [7 ])
138
+
139
+ # Adding labels should invalidate the old style
140
+ _maybe_split_collections (split_collections )
141
+
142
+ cs .clabel (manual = [(0.2 , 0.1 )])
143
+
124
144
_maybe_split_collections (split_collections )
125
145
126
146
@@ -232,6 +252,9 @@ def test_labels(split_collections):
232
252
disp_units = [(216 , 177 ), (359 , 290 ), (521 , 406 )]
233
253
data_units = [(- 2 , .5 ), (0 , - 1.5 ), (2.8 , 1 )]
234
254
255
+ # Adding labels should invalidate the old style
256
+ _maybe_split_collections (split_collections )
257
+
235
258
CS .clabel ()
236
259
237
260
for x , y in data_units :
0 commit comments