@@ -200,7 +200,7 @@ def test_confusion_matrix_contrast(pyplot):
200
200
assert_allclose (disp .text_ [0 , 0 ].get_color (), [0.0 , 0.0 , 0.0 , 1.0 ])
201
201
assert_allclose (disp .text_ [1 , 1 ].get_color (), [0.0 , 0.0 , 0.0 , 1.0 ])
202
202
203
- # oof -diagonal text is white
203
+ # off -diagonal text is white
204
204
assert_allclose (disp .text_ [0 , 1 ].get_color (), [1.0 , 1.0 , 1.0 , 1.0 ])
205
205
assert_allclose (disp .text_ [1 , 0 ].get_color (), [1.0 , 1.0 , 1.0 , 1.0 ])
206
206
@@ -209,10 +209,24 @@ def test_confusion_matrix_contrast(pyplot):
209
209
assert_allclose (disp .text_ [0 , 1 ].get_color (), [0.0 , 0.0 , 0.0 , 1.0 ])
210
210
assert_allclose (disp .text_ [1 , 0 ].get_color (), [0.0 , 0.0 , 0.0 , 1.0 ])
211
211
212
- # oof -diagonal text is black
212
+ # off -diagonal text is black
213
213
assert_allclose (disp .text_ [0 , 0 ].get_color (), [1.0 , 1.0 , 1.0 , 1.0 ])
214
214
assert_allclose (disp .text_ [1 , 1 ].get_color (), [1.0 , 1.0 , 1.0 , 1.0 ])
215
215
216
+ # Regression test for #15920
217
+ cm = np .array ([[19 , 34 ], [32 , 58 ]])
218
+ disp = ConfusionMatrixDisplay (cm , display_labels = [0 , 1 ])
219
+
220
+ disp .plot (cmap = pyplot .cm .Blues )
221
+ min_color = pyplot .cm .Blues (0 )
222
+ max_color = pyplot .cm .Blues (255 )
223
+ assert_allclose (disp .text_ [0 , 0 ].get_color (), max_color )
224
+ assert_allclose (disp .text_ [0 , 1 ].get_color (), max_color )
225
+ assert_allclose (disp .text_ [1 , 0 ].get_color (), max_color )
226
+ assert_allclose (disp .text_ [1 , 1 ].get_color (), min_color )
227
+
228
+
229
+
216
230
217
231
@pytest .mark .parametrize (
218
232
"clf" , [LogisticRegression (),
0 commit comments