Plotting Routines

plots: This module provides various plotting routines that ensure we display our spatially referenced data in logical, consistant ways across projects.

display

wtools.plots.display(plt, arr, x=None, y=None, **kwargs)[source]

This provides a convienant class for plotting 2D arrays that avoids treating our data like images. Since most datasets we work with are defined on Cartesian coordinates, <i,j,k> == <x,y,z>, we need to transpose our arrays before plotting in image plotting libraries like matplotlib.

Parameters:
  • plt (handle) – your active plotting handle
  • arr (np.ndarray) – A 2D array to plot
  • kwargs (dict) – Any kwargs to pass to the pcolormesh plotting routine
Returns:

plt.pcolormesh

Example

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> arr = np.arange(1000).reshape((10,100))
>>> wtools.display(plt, arr)
>>> plt.title('What we actually want')
>>> plt.colorbar()
>>> plt.show()

plot_struct_grid

wtools.plots.plot_struct_grid(plt, outStruct, gridspecs=None, imeas=None)[source]

Plot a semivariogram or covariogram produced from raster_to_struct_grid

Parameters:
  • plt (handle) – An active plotting handle. This allows us to use the plotted result after the routine.
  • outStruct (np.ndarray) – the data to plot
  • gridspecs (list(GridSpec)) – the spatial reference of your gdata
  • imeas (str) – key indicating which structural measure to label: 'var' for semi-variogram or 'covar' for covariogram. This simply adds a few labels to the active figure. If semi-variance use True. If covariance, use False.
Returns:

plt.plot or plt.pcolor