File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -5630,6 +5630,15 @@ def _interp_grid(X):
5630
5630
# helper for below
5631
5631
if np .shape (X )[1 ] > 1 :
5632
5632
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 } )." )
5633
5642
X = np .hstack ((X [:, [0 ]] - dX [:, [0 ]],
5634
5643
X [:, :- 1 ] + dX ,
5635
5644
X [:, [- 1 ]] + dX [:, [- 1 ]]))
Original file line number Diff line number Diff line change @@ -1162,6 +1162,13 @@ def test_pcolorargs():
1162
1162
x = np .ma .array (x , mask = (x < 0 ))
1163
1163
with pytest .raises (ValueError ):
1164
1164
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' )
1165
1172
1166
1173
1167
1174
@check_figures_equal (extensions = ["png" ])
You can’t perform that action at this time.
0 commit comments