flopy.plot.map Module

class flopy.plot.map.ModelMap(sr=None, ax=None, model=None, dis=None, layer=0, extent=None, xul=None, yul=None, xll=None, yll=None, rotation=0.0, length_multiplier=1.0)

Class to create a map of the model.

Parameters:

sr : flopy.utils.reference.SpatialReference

The spatial reference class (Default is None)

ax : matplotlib.pyplot axis

The plot axis. If not provided it, plt.gca() will be used. If there is not a current axis then a new one will be created.

model : flopy.modflow object

flopy model object. (Default is None)

dis : flopy.modflow.ModflowDis object

flopy discretization object. (Default is None)

layer : int

Layer to plot. Default is 0. Must be between 0 and nlay - 1.

xul : float

x coordinate for upper left corner

yul : float

y coordinate for upper left corner. The default is the sum of the delc array.

rotation : float

Angle of grid rotation around the upper left corner. A positive value indicates clockwise rotation. Angles are in degrees.

extent : tuple of floats

(xmin, xmax, ymin, ymax) will be used to specify axes limits. If None then these will be calculated based on grid, coordinates, and rotation.

Notes

ModelMap must know the position and rotation of the grid in order to make the plot. This information is contained in the SpatialReference class (sr), which can be passed. If sr is None, then it looks for sr in dis. If dis is None, then it looks for sr in model.dis. If all of these arguments are none, then it uses xul, yul, and rotation. If none of these arguments are provided, then it puts the lower-left-hand corner of the grid at (0, 0).

contour_array(a, masked_values=None, **kwargs)

Contour an array. If the array is three-dimensional, then the method will contour the layer tied to this class (self.layer).

Parameters:

a : numpy.ndarray

Array to plot.

masked_values : iterable of floats, ints

Values to mask.

**kwargs : dictionary

keyword arguments passed to matplotlib.pyplot.pcolormesh

Returns:

contour_set : matplotlib.pyplot.contour

contour_array_cvfd(vertc, a, masked_values=None, **kwargs)

Contour an array. If the array is three-dimensional, then the method will contour the layer tied to this class (self.layer).

Parameters:

vertc : np.ndarray

Array with of size (nc, 2) with centroid location of cvfd

a : numpy.ndarray

Array to plot.

masked_values : iterable of floats, ints

Values to mask.

**kwargs : dictionary

keyword arguments passed to matplotlib.pyplot.pcolormesh

Returns:

contour_set : matplotlib.pyplot.contour

plot_array(a, masked_values=None, **kwargs)

Plot an array. If the array is three-dimensional, then the method will plot the layer tied to this class (self.layer).

Parameters:

a : numpy.ndarray

Array to plot.

masked_values : iterable of floats, ints

Values to mask.

**kwargs : dictionary

keyword arguments passed to matplotlib.pyplot.pcolormesh

Returns:

quadmesh : matplotlib.collections.QuadMesh

plot_bc(ftype=None, package=None, kper=0, color=None, plotAll=False, **kwargs)

Plot boundary conditions locations for a specific boundary type from a flopy model

Parameters:

ftype : string

Package name string (‘WEL’, ‘GHB’, etc.). (Default is None)

package : flopy.modflow.Modflow package class instance

flopy package class instance. (Default is None)

kper : int

Stress period to plot

color : string

matplotlib color string. (Default is None)

plotAll : bool

Boolean used to specify that boundary condition locations for all layers will be plotted on the current ModelMap layer. (Default is False)

**kwargs : dictionary

keyword arguments passed to matplotlib.collections.PatchCollection

Returns:

quadmesh : matplotlib.collections.QuadMesh

plot_cvfd(verts, iverts, **kwargs)

Plot a cvfd grid. The vertices must be in the same coordinates as the rotated and offset grid.

Parameters:

verts : ndarray

2d array of x and y points.

iverts : list of lists

should be of len(ncells) with a list of vertex number for each cell

kwargs : dictionary

Keyword arguments passed to plotutil.plot_cvfd()

plot_discharge(frf, fff, dis=None, flf=None, head=None, istep=1, jstep=1, normalize=False, **kwargs)

Use quiver to plot vectors.

Parameters:

frf : numpy.ndarray

MODFLOW’s ‘flow right face’

fff : numpy.ndarray

MODFLOW’s ‘flow front face’

flf : numpy.ndarray

MODFLOW’s ‘flow lower face’ (Default is None.)

head : numpy.ndarray

MODFLOW’s head array. If not provided, then will assume confined conditions in order to calculated saturated thickness.

istep : int

row frequency to plot. (Default is 1.)

jstep : int

column frequency to plot. (Default is 1.)

normalize : bool

boolean flag used to determine if discharge vectors should be normalized using the magnitude of the specific discharge in each cell. (default is False)

kwargs : dictionary

Keyword arguments passed to plt.quiver()

Returns:

quiver : matplotlib.pyplot.quiver

Vectors of specific discharge.

plot_endpoint(ep, direction='ending', selection=None, selection_direction=None, **kwargs)

Plot the MODPATH endpoints.

Parameters:

ep : rec array

A numpy recarray with the endpoint particle data from the MODPATH 6 endpoint file

direction : str

String defining if starting or ending particle locations should be considered. (default is ‘ending’)

selection : tuple

tuple that defines the zero-base layer, row, column location (l, r, c) to use to make a selection of particle endpoints. The selection could be a well location to determine capture zone for the well. If selection is None, all particle endpoints for the user-sepcified direction will be plotted. (default is None)

selection_direction : str

String defining is a selection should be made on starting or ending particle locations. If selection is not None and selection_direction is None, the selection direction will be set to the opposite of direction. (default is None)

kwargs : ax, c, s or size, colorbar, colorbar_label, shrink. The

remaining kwargs are passed into the matplotlib scatter method. If colorbar is True a colorbar will be added to the plot. If colorbar_label is passed in and colorbar is True then colorbar_label will be passed to the colorbar set_label() method. If shrink is passed in and colorbar is True then the colorbar size will be set using shrink.

Returns:

sp : matplotlib.pyplot.scatter

plot_grid(**kwargs)

Plot the grid lines.

Parameters:

kwargs : ax, colors. The remaining kwargs are passed into the

the LineCollection constructor.

Returns:

lc : matplotlib.collections.LineCollection

plot_ibound(ibound=None, color_noflow='black', color_ch='blue', **kwargs)

Make a plot of ibound. If not specified, then pull ibound from the self.ml

Parameters:

ibound : numpy.ndarray

ibound array to plot. (Default is ibound in ‘BAS6’ package.)

color_noflow : string

(Default is ‘black’)

color_ch : string

Color for constant heads (Default is ‘blue’.)

Returns:

quadmesh : matplotlib.collections.QuadMesh

plot_inactive(ibound=None, color_noflow='black', **kwargs)

Make a plot of inactive cells. If not specified, then pull ibound from the self.ml

Parameters:

ibound : numpy.ndarray

ibound array to plot. (Default is ibound in ‘BAS6’ package.)

color_noflow : string

(Default is ‘black’)

Returns:

quadmesh : matplotlib.collections.QuadMesh

plot_pathline(pl, travel_time=None, **kwargs)

Plot the MODPATH pathlines.

Parameters:

pl : list of rec arrays or a single rec array

rec array or list of rec arrays is data returned from modpathfile PathlineFile get_data() or get_alldata() methods. Data in rec array is ‘x’, ‘y’, ‘z’, ‘time’, ‘k’, and ‘particleid’.

travel_time: float or str

travel_time is a travel time selection for the displayed pathlines. If a float is passed then pathlines with times less than or equal to the passed time are plotted. If a string is passed a variety logical constraints can be added in front of a time value to select pathlines for a select period of time. Valid logical constraints are <=, <, >=, and >. For example, to select all pathlines less than 10000 days travel_time=’< 10000’ would be passed to plot_pathline. (default is None)

kwargs : layer, ax, colors. The remaining kwargs are passed

into the LineCollection constructor. If layer=’all’, pathlines are output for all layers

Returns:

lc : matplotlib.collections.LineCollection

plot_shapefile(shp, **kwargs)

Plot a shapefile. The shapefile must be in the same coordinates as the rotated and offset grid.

Parameters:

shp : string

Name of the shapefile to plot

kwargs : dictionary

Keyword arguments passed to plotutil.plot_shapefile()