File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5630,6 +5630,15 @@ def _interp_grid(X):
56305630 # helper for below
56315631 if np .shape (X )[1 ] > 1 :
56325632 dX = np .diff (X , axis = 1 )/ 2.
5633+ if not (np .all (dX >= 0 ) or np .all (dX <= 0 )):
5634+ cbook ._warn_external (
5635+ f"The input coordinates to { funcname } are "
5636+ "not all either increasing or decreasing, "
5637+ "the automatically computed edges can "
5638+ "produce misleading results in this case. "
5639+ "It is recommended to supply the "
5640+ f"quadrilateral edges to { funcname } "
5641+ f" yourself. See help({ funcname } )." )
56335642 X = np .hstack ((X [:, [0 ]] - dX [:, [0 ]],
56345643 X [:, :- 1 ] + dX ,
56355644 X [:, [- 1 ]] + dX [:, [- 1 ]]))
Original file line number Diff line number Diff line change @@ -1162,6 +1162,13 @@ def test_pcolorargs():
11621162 x = np .ma .array (x , mask = (x < 0 ))
11631163 with pytest .raises (ValueError ):
11641164 ax .pcolormesh (x , y , Z [:- 1 , :- 1 ])
1165+ # Expect a warning with non-increasing coordinates
1166+ x = [359 , 0 , 1 ]
1167+ y = [- 10 , 10 ]
1168+ X , Y = np .meshgrid (x , y )
1169+ Z = np .zeros (X .shape )
1170+ with pytest .warns (UserWarning , match = "The input coordinates" ):
1171+ ax .pcolormesh (X , Y , Z , shading = 'auto' )
11651172
11661173
11671174@check_figures_equal (extensions = ["png" ])
You can’t perform that action at this time.
0 commit comments