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 @@ -5576,6 +5576,15 @@ def _interp_grid(X):
55765576 # helper for below
55775577 if np .shape (X )[1 ] > 1 :
55785578 dX = np .diff (X , axis = 1 )/ 2.
5579+ if not (np .all (dX >= 0 ) or np .all (dX <= 0 )):
5580+ cbook ._warn_external (
5581+ f"The input coordinates to { funcname } are "
5582+ "not all either increasing or decreasing, "
5583+ "the automatically computed edges can "
5584+ "produce misleading results in this case. "
5585+ "It is recommended to supply the "
5586+ f"quadrilateral edges to { funcname } "
5587+ f" yourself. See help({ funcname } )." )
55795588 X = np .hstack ((X [:, [0 ]] - dX [:, [0 ]],
55805589 X [:, :- 1 ] + dX ,
55815590 X [:, [- 1 ]] + dX [:, [- 1 ]]))
Original file line number Diff line number Diff line change @@ -1175,6 +1175,13 @@ def test_pcolorargs():
11751175 x = np .ma .array (x , mask = (x < 0 ))
11761176 with pytest .raises (ValueError ):
11771177 ax .pcolormesh (x , y , Z [:- 1 , :- 1 ])
1178+ # Expect a warning with non-increasing coordinates
1179+ x = [359 , 0 , 1 ]
1180+ y = [- 10 , 10 ]
1181+ X , Y = np .meshgrid (x , y )
1182+ Z = np .zeros (X .shape )
1183+ with pytest .warns (UserWarning , match = "The input coordinates" ):
1184+ ax .pcolormesh (X , Y , Z , shading = 'auto' )
11781185
11791186
11801187@check_figures_equal (extensions = ["png" ])
You can’t perform that action at this time.
0 commit comments