15
15
16
16
from .utils import _determine_cmap_params , _infer_xy_labels
17
17
from .facetgrid import FacetGrid
18
- from ..core .utils import is_uniform_spaced
19
18
20
19
21
20
# Maybe more appropriate to keep this in .utils
@@ -58,19 +57,18 @@ def _easy_facetgrid(darray, plotfunc, x, y, row=None, col=None, col_wrap=None,
58
57
def plot (darray , row = None , col = None , col_wrap = None , ax = None , rtol = 0.01 ,
59
58
subplot_kws = None , ** kwargs ):
60
59
"""
61
- Default plot of DataArray using matplotlib / pylab .
60
+ Default plot of DataArray using matplotlib.pyplot .
62
61
63
62
Calls xray plotting function based on the dimensions of
64
63
darray.squeeze()
65
64
66
- =============== =========== ===========================
67
- Dimensions Coordinates Plotting function
68
- --------------- ----------- ---------------------------
69
- 1 :py:func:`xray.plot.line`
70
- 2 Uniform :py:func:`xray.plot.imshow`
71
- 2 Irregular :py:func:`xray.plot.contourf`
72
- Anything else :py:func:`xray.plot.hist`
73
- =============== =========== ===========================
65
+ =============== ===========================
66
+ Dimensions Plotting function
67
+ --------------- ---------------------------
68
+ 1 :py:func:`xray.plot.line`
69
+ 2 :py:func:`xray.plot.pcolormesh`
70
+ Anything else :py:func:`xray.plot.hist`
71
+ =============== ===========================
74
72
75
73
Parameters
76
74
----------
@@ -115,9 +113,7 @@ def plot(darray, row=None, col=None, col_wrap=None, ax=None, rtol=0.01,
115
113
kwargs ['col_wrap' ] = col_wrap
116
114
kwargs ['subplot_kws' ] = subplot_kws
117
115
118
- indexes = (darray .indexes [dim ].values for dim in plot_dims )
119
- uniform = all (is_uniform_spaced (i , rtol = rtol ) for i in indexes )
120
- plotfunc = imshow if uniform else contourf
116
+ plotfunc = pcolormesh
121
117
else :
122
118
if row or col :
123
119
raise ValueError (error_msg )
@@ -335,7 +331,7 @@ def _plot2d(plotfunc):
335
331
336
332
@functools .wraps (plotfunc )
337
333
def newplotfunc (darray , x = None , y = None , ax = None , row = None , col = None ,
338
- col_wrap = None , xincrease = None , yincrease = None ,
334
+ col_wrap = None , xincrease = True , yincrease = True ,
339
335
add_colorbar = True , add_labels = True , vmin = None , vmax = None ,
340
336
cmap = None , center = None , robust = False , extend = None ,
341
337
levels = None , colors = None , subplot_kws = None , ** kwargs ):
@@ -429,7 +425,7 @@ def newplotfunc(darray, x=None, y=None, ax=None, row=None, col=None,
429
425
if add_colorbar :
430
426
cbar = plt .colorbar (primitive , ax = ax , extend = cmap_params ['extend' ])
431
427
if darray .name and add_labels :
432
- cbar .set_label (darray .name )
428
+ cbar .set_label (darray .name , rotation = 90 )
433
429
434
430
_update_axes_limits (ax , xincrease , yincrease )
435
431
@@ -438,7 +434,7 @@ def newplotfunc(darray, x=None, y=None, ax=None, row=None, col=None,
438
434
# For use as DataArray.plot.plotmethod
439
435
@functools .wraps (newplotfunc )
440
436
def plotmethod (_PlotMethods_obj , x = None , y = None , ax = None , row = None ,
441
- col = None , col_wrap = None , xincrease = None , yincrease = None ,
437
+ col = None , col_wrap = None , xincrease = True , yincrease = True ,
442
438
add_colorbar = True , add_labels = True , vmin = None , vmax = None ,
443
439
cmap = None , colors = None , center = None , robust = False ,
444
440
extend = None , levels = None , subplot_kws = None , ** kwargs ):
@@ -464,7 +460,7 @@ def plotmethod(_PlotMethods_obj, x=None, y=None, ax=None, row=None,
464
460
@_plot2d
465
461
def imshow (x , y , z , ax , ** kwargs ):
466
462
"""
467
- Image plot of 2d DataArray using matplotlib / pylab
463
+ Image plot of 2d DataArray using matplotlib.pyplot
468
464
469
465
Wraps matplotlib.pyplot.imshow
470
466
@@ -478,7 +474,7 @@ def imshow(x, y, z, ax, **kwargs):
478
474
"""
479
475
480
476
if x .ndim != 1 or y .ndim != 1 :
481
- raise ValueError ('Imshow requires 1D coordinates, try using '
477
+ raise ValueError ('imshow requires 1D coordinates, try using '
482
478
'pcolormesh or contour(f)' )
483
479
484
480
# Centering the pixels- Assumes uniform spacing
0 commit comments