Plot¶
These need the plot extra (pip install "disp_xr[plot]"). The functions
live in disp_xr.plot and are methods of the accessor:
ds.disp.plot_map(), ds.disp.plot_point(lon, lat).
Quick-look maps and point time series (plot extra).
Plotting is one of the two places disp-xr computes (with export): a map loads
one epoch, a point loads one pixel series. Both convert lengths to units
(millimeters by default) and label the axes with them.
Displacement is signed (positive toward the satellite), so maps use a diverging blue-gray-red scale centered on zero, with limits symmetric about it. Point plots draw a dashed rule at every reference-date change, where a chained series is joined or an unchained one restarts at zero.
plot_map ¶
plot_map(obj: Union[Dataset, DataArray], time: Optional[Any] = None, *, layer: str = 'displacement', units: Optional[str] = 'mm', vmax: Optional[float] = None, percentile: float = 98.0, cmap: Optional[Union[str, Colormap]] = None, max_pixels: int = 2000, ax: Optional[Axes] = None, title: Optional[str] = None) -> Axes
Map one epoch of a layer (or a 2D layer such as velocity).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Dataset or DataArray
|
A DISP dataset ( |
required |
time
|
date - like
|
Epoch to plot, the nearest one to this date. Defaults to the last. |
None
|
layer
|
str
|
Layer of a Dataset to plot. |
'displacement'
|
units
|
str
|
Length unit for the color scale ( |
'mm'
|
vmax
|
float
|
Color limit; the scale runs from |
None
|
percentile
|
float
|
Percentile of |
98.0
|
cmap
|
str or Colormap
|
Defaults to :func: |
None
|
max_pixels
|
int
|
Larger maps are block-averaged so that neither side exceeds this many pixels before loading. |
2000
|
ax
|
matplotlib Axes
|
Axes to draw on; a new figure otherwise. |
None
|
title
|
str
|
Defaults to the layer, the epoch and the reference date. |
None
|
Returns:
| Type | Description |
|---|---|
Axes
|
|
Examples:
plot_point ¶
plot_point(obj: Union[Dataset, DataArray], lon: Optional[float] = None, lat: Optional[float] = None, *, row: Optional[int] = None, col: Optional[int] = None, buffer_m: float = 0.0, layer: str = 'displacement', units: Optional[str] = 'mm', ax: Optional[Axes] = None, title: Optional[str] = None) -> Axes
Plot the time series at one point, with reference-change markers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Dataset or DataArray
|
A DISP dataset ( |
required |
lon
|
float
|
Point location; or give |
None
|
lat
|
float
|
Point location; or give |
None
|
row
|
int
|
Pixel indices, instead of |
None
|
col
|
int
|
Pixel indices, instead of |
None
|
buffer_m
|
float
|
Plot the median of the pixels within this distance (a square window) instead of one pixel. |
0.0
|
layer
|
str
|
Layer of a Dataset to plot. |
'displacement'
|
units
|
str
|
Length unit of the y axis; |
'mm'
|
ax
|
matplotlib Axes
|
Axes to draw on; a new figure otherwise. |
None
|
title
|
str
|
Defaults to the layer and the point. |
None
|
Returns:
| Type | Description |
|---|---|
Axes
|
|
Raises:
| Type | Description |
|---|---|
OutOfBoundsError
|
If the point is outside the grid. |
Examples: