imshow#

geowombat.util.imshow(data, mask=False, nodata=0, flip=False, text_color='black', rot=30, **kwargs)#

Shows an image on a plot.

Parameters:
  • data (xarray.DataArray or xarray.Dataset) – The data to plot.

  • mask (Optional[bool]) – Whether to mask ‘no data’ values (given by nodata).

  • nodata (Optional[int or float]) – The ‘no data’ value.

  • flip (Optional[bool]) – Whether to flip an RGB array’s band order.

  • text_color (Optional[str]) – The text color.

  • rot (Optional[int]) – The degree rotation for the x-axis tick labels.

  • kwargs (Optional[dict]) – Keyword arguments passed to xarray.plot.imshow.

Returns:

matplotlib axis object

Examples

>>> import geowombat as gw
>>>
>>> # Open a 3-band image and plot the first band
>>> with gw.open('image.tif') as ds:
>>>     ax = ds.sel(band=1).gw.imshow()
>>>
>>> # Open and plot a 3-band image
>>> with gw.open('image.tif') as ds:
>>>
>>>     ax = ds.sel(band=['red', 'green', 'blue']).gw.imshow(mask=True,
>>>                                                          nodata=0,
>>>                                                          vmin=0.1,
>>>                                                          vmax=0.9,
>>>                                                          robust=True)