This page was generated from plot_array_example.py. It's also available as a notebook.

Plotting Model Arrays and Results

This notebook demonstrates the simple array and results plotting capabilities of flopy. It demonstrates these capabilities by loading and running an existing model, and then showing how the .plot() method can be used to make simple plots of the model data and model results.

[1]:
import os
import sys
from tempfile import TemporaryDirectory
[2]:
import matplotlib as mpl
import numpy as np
[3]:
from IPython.display import Image

import flopy

print(sys.version)
print(f"numpy version: {np.__version__}")
print(f"matplotlib version: {mpl.__version__}")
print(f"flopy version: {flopy.__version__}")
3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:50:58) [GCC 12.3.0]
numpy version: 1.26.4
matplotlib version: 3.8.4
flopy version: 3.7.0.dev0
[4]:
# Set name of MODFLOW exe
#  assumes executable is in users path statement
version = "mf2005"
exe_name = "mf2005"

# Set the paths
loadpth = os.path.join("..", "..", "examples", "data", "secp")

# temporary directory
temp_dir = TemporaryDirectory()
modelpth = temp_dir.name

# make sure modelpth directory exists
if not os.path.isdir(modelpth):
    os.makedirs(modelpth, exist_ok=True)

files = ["secp.hds"]

Load and Run an Existing Model

A model called the “Southeast Coastal Plain Model” is located in the loadpth folder. In the following code block, we load that model, then change into a new workspace (modelpth) where we recreate and run the model. For this to work properly, the MODFLOW-2005 executable (mf2005) must be in the path. We verify that it worked correctly by checking for the presence of secp.hds.

[5]:
ml = flopy.modflow.Modflow.load(
    "secp.nam", model_ws=loadpth, exe_name=exe_name, version=version
)
ml.change_model_ws(new_pth=modelpth)
ml.write_input()

success, buff = ml.run_model(silent=True)
if not success:
    print("Something bad happened.")

# confirm that the model files have been created
for f in files:
    if os.path.isfile(os.path.join(modelpth, f)):
        msg = f"Output file located: {f}"
        print(msg)
    else:
        errmsg = f"Error. Output file cannot be found: {f}"
        print(errmsg)
Output file located: secp.hds

Plotting Model Data

Once a model object is created MODFLOW package data can be plotted using the .plot() method.

Two-dimensional data (for example the model top) can be plotted by calling the .plot() method for each data array.

[6]:
ml.modelgrid.plot()
[6]:
<matplotlib.collections.LineCollection at 0x7fa2fbea58e0>
../_images/Notebooks_plot_array_example_8_1.png

As you can see, the .plot() methods returns a matplotlib.pyplot axis object, which can be used to add additional data to the figure. Below we will add black contours to the axis returned in the first line.

[7]:
ax = ml.dis.top.plot()
ml.dis.top.plot(axes=ax, contour=True, pcolor=False)
[7]:
<Axes: title={'center': 'model_top'}>
../_images/Notebooks_plot_array_example_10_1.png
<Figure size 640x480 with 0 Axes>

You will notice that we passed several keywords in the second line. There are a number of keywords that can be passed to the .plot() method to control plotting. Available keywords are:

  1. axes - if you already have plot axes you can pass them to the method

  2. pcolor - turns pcolor on if pcolor=True or off if pcolor=False, default is pcolor=True

  3. colorbar - turns on colorbar if colorbar=True or off if colorbar=False, default is colorbar=False and is only used if pcolor=True

  4. inactive - turns on a black inactive cell overlay if inactive=True or turns off the inactive cell overlay if inactive=False, default is inactive=True

  5. contour - turns on contours if contour=True or off if contour=False, default is contour=False

  6. clabel - turns on contour labels if clabel=True or off if clabel=False, default is clabel=False and is only used if contour=True

  7. grid - turns on model grid if grid=True or off if grid=False, default is grid=False

  8. masked_values - list with unique values to be excluded from the plot (for example, HNOFLO)

  9. mflay - for three-dimensional data (for example layer bottoms or simulated heads) mflay can be used to plot data for a single layer - note mflay is zero-based

  10. kper - for transient two-dimensional data (for example recharge package data) kper can be used to plot data for a single stress period - note kper is zero-based

  11. filename_base - a base file name that will be used to automatically generate file names for two-dimensional, three-dimensional, and transient two-dimensional data, default is filename_base=None

  12. file_extension - valid matplotlib file extension, default is png and is only used if filename_base is specified

  13. matplotlib.pyplot keywords are also accepted

The previous code block is recreated in a single line using keywords in the code block below.

[8]:
ml.dis.top.plot(contour=True)
[8]:
<Axes: title={'center': 'model_top'}>
../_images/Notebooks_plot_array_example_12_1.png

We can save the same image to a file.

[9]:
fname = os.path.join(modelpth, "secp")
ml.dis.top.plot(contour=True, filename_base=fname)
    created...secp_model_top.png

The image file that was just created is shown below

[10]:
fname = os.path.join(modelpth, "secp_model_top.png")
Image(filename=fname)
[10]:
../_images/Notebooks_plot_array_example_16_0.png

Plotting three-dimensional data

Three-dimensional data can be plotted using the .plot() method. User’s do not actually need to know that the data are two- or three-dimensional. The .plot() method is attached to the two- and three-dimensional data objects so it knows how to process the model data. Examples of three-dimensional data are horizontal hydraulic conductivity (hk), layer bottoms (botm), specific yield (sy), etc.

Here we plot the horizontal hydraulic conductivity for each layer. We are also masking areas where the horizontal hydraulic conductivity is zero and adding a color bar.

[11]:
ml.lpf.hk.plot(masked_values=[0.0], colorbar=True)
[11]:
[<Axes: title={'center': 'hk layer 1'}>,
 <Axes: title={'center': 'hk layer 2'}>,
 <Axes: title={'center': 'hk layer 3'}>,
 <Axes: title={'center': 'hk layer 4'}>,
 <Axes: title={'center': 'hk layer 5'}>,
 <Axes: title={'center': 'hk layer 6'}>,
 <Axes: title={'center': 'hk layer 7'}>,
 <Axes: title={'center': 'hk layer 8'}>,
 <Axes: title={'center': 'hk layer 9'}>,
 <Axes: title={'center': 'hk layer 10'}>,
 <Axes: title={'center': 'hk layer 11'}>,
 <Axes: title={'center': 'hk layer 12'}>,
 <Axes: title={'center': 'hk layer 13'}>,
 <Axes: title={'center': 'hk layer 14'}>,
 <Axes: title={'center': 'hk layer 15'}>,
 <Axes: title={'center': 'hk layer 16'}>]
../_images/Notebooks_plot_array_example_18_1.png
../_images/Notebooks_plot_array_example_18_2.png
../_images/Notebooks_plot_array_example_18_3.png
../_images/Notebooks_plot_array_example_18_4.png
../_images/Notebooks_plot_array_example_18_5.png
../_images/Notebooks_plot_array_example_18_6.png
../_images/Notebooks_plot_array_example_18_7.png
../_images/Notebooks_plot_array_example_18_8.png
../_images/Notebooks_plot_array_example_18_9.png
../_images/Notebooks_plot_array_example_18_10.png
../_images/Notebooks_plot_array_example_18_11.png
../_images/Notebooks_plot_array_example_18_12.png
../_images/Notebooks_plot_array_example_18_13.png
../_images/Notebooks_plot_array_example_18_14.png
../_images/Notebooks_plot_array_example_18_15.png
../_images/Notebooks_plot_array_example_18_16.png

In addition to the plots of horizontal hydraulic conductivity you can see that the .plot() method returned a list containing 16 axis objects (one for each layer).

Plotting data for a single layer

If the mflay= keyword is provided to the plot.() method then data for an individual layer is plotted. Remember mflay is zero-based.

Here we plot the horizontal hydraulic conductivity for layer 11 (mflay=10).

[12]:
ml.lpf.hk.plot(mflay=10, masked_values=[0.0], colorbar=True)
[12]:
<Axes: title={'center': 'hk layer 11'}>
../_images/Notebooks_plot_array_example_20_1.png

Plotting transient two-dimensional data

Transient two-dimensional data can be plotted using the .plot() method. User’s do not actually need to know that the data are two- or three-dimensional. The .plot() method is attached to the two- and three-dimensional, and transient two-dimensional data objects so it knows how to process the model data. Examples of transient two-dimensional data are recharge rates (rch.rech) and evapotranspiration rates (evt.evtr).

Here we plot recharge rates for all six stress periods in the model. We are also masking areas where the recharge rate is zero and adding a color bar.

[13]:
ml.rch.rech.plot(kper="all", masked_values=[0.0], colorbar=True)
[13]:
[<Axes: title={'center': 'RECH stress period 1'}>,
 <Axes: title={'center': 'RECH stress period 2'}>,
 <Axes: title={'center': 'RECH stress period 3'}>,
 <Axes: title={'center': 'RECH stress period 4'}>,
 <Axes: title={'center': 'RECH stress period 5'}>,
 <Axes: title={'center': 'RECH stress period 6'}>]
../_images/Notebooks_plot_array_example_22_1.png
../_images/Notebooks_plot_array_example_22_2.png
../_images/Notebooks_plot_array_example_22_3.png
../_images/Notebooks_plot_array_example_22_4.png
../_images/Notebooks_plot_array_example_22_5.png
../_images/Notebooks_plot_array_example_22_6.png

In addition to the plots of recharge rates you can see that the .plot() method returned a list containing 6 axis objects (one for each stress period).

Plotting data for a single stress period

If the kper= keyword is provided to the plot.() method then data for an individual stress period is plotted. Remember kper is zero-based.

Here we plot the recharge rate for stress period 6 (kper=5).

[14]:
ml.rch.rech.plot(kper=5, masked_values=[0.0], colorbar=True)
[14]:
[<Axes: title={'center': 'RECH stress period 6'}>]
../_images/Notebooks_plot_array_example_24_1.png

We can also save the image to a file by provided the filename_base keyword with an appropriate base file name.

[15]:
fr = os.path.join(modelpth, "secp")
ml.rch.rech.plot(kper=5, masked_values=[0.0], colorbar=True, filename_base=fr)
    created...secp_RECH_00006.png
[15]:
[None]

If the kper keyword is not provided images are saved for each stress period in the model.

The image file that was just created of recharge rates for stress period 6 is is shown below.

[16]:
fname = os.path.join(modelpth, "secp_RECH_00006.png")
Image(filename=fname)
[16]:
../_images/Notebooks_plot_array_example_28_0.png

Plotting simulated model results

Simulated model results can be plotted using the .plot() method.

First we create an instance of the HeadFile class with the simulated head file (secp.hds) and extract the simulation times available in the binary head file using the .get_times() method. Here we plot last simulated heads in the binary heads file (totim=times[-1]). We are also masking cells having the HDRY (-9999.0) value and adding a color bar.

[17]:
print(files)
fname = os.path.join(modelpth, files[0])
hdobj = flopy.utils.HeadFile(fname, model=ml)
times = hdobj.get_times()
head = hdobj.plot(totim=times[-1], masked_values=[-9999.0], colorbar=True)
['secp.hds']
../_images/Notebooks_plot_array_example_30_1.png
../_images/Notebooks_plot_array_example_30_2.png
../_images/Notebooks_plot_array_example_30_3.png
../_images/Notebooks_plot_array_example_30_4.png
../_images/Notebooks_plot_array_example_30_5.png
../_images/Notebooks_plot_array_example_30_6.png
../_images/Notebooks_plot_array_example_30_7.png
../_images/Notebooks_plot_array_example_30_8.png
../_images/Notebooks_plot_array_example_30_9.png
../_images/Notebooks_plot_array_example_30_10.png
../_images/Notebooks_plot_array_example_30_11.png
../_images/Notebooks_plot_array_example_30_12.png
../_images/Notebooks_plot_array_example_30_13.png
../_images/Notebooks_plot_array_example_30_14.png
../_images/Notebooks_plot_array_example_30_15.png
../_images/Notebooks_plot_array_example_30_16.png

Plotting results for a single layer

If the mflay= keyword is provided to the plot.() method then results for an individual layer can be plotted. Remember mflay is zero-based.

Here we plot the results for layer 2 (mflay=1) for stress period 2 (totim=times[1]). We also add black contour lines.

[18]:
head = hdobj.plot(
    totim=times[1],
    mflay=1,
    masked_values=[-9999.0],
    colorbar=True,
    contour=True,
    colors="black",
)
../_images/Notebooks_plot_array_example_32_0.png

We can also save the plots of the head results for every layer (or a single layer) to a file by provided the filename_base keyword with an appropriate base file name.

[19]:
fh = os.path.join(modelpth, "secp_head")
head = hdobj.plot(
    totim=times[-1],
    masked_values=[-9999.0],
    colorbar=True,
    contour=True,
    colors="black",
    filename_base=fh,
)
    created...secp_head_Layer1.png
    created...secp_head_Layer2.png
    created...secp_head_Layer3.png
    created...secp_head_Layer4.png
    created...secp_head_Layer5.png
    created...secp_head_Layer6.png
    created...secp_head_Layer7.png
    created...secp_head_Layer8.png
    created...secp_head_Layer9.png
    created...secp_head_Layer10.png
    created...secp_head_Layer11.png
    created...secp_head_Layer12.png
    created...secp_head_Layer13.png
    created...secp_head_Layer14.png
    created...secp_head_Layer15.png
    created...secp_head_Layer16.png

The image file that was just created of the simulated head for layer 2 for stress period 6 is is shown below.

[20]:
fname = os.path.join(modelpth, "secp_head_Layer2.png")
Image(filename=fname)
[20]:
../_images/Notebooks_plot_array_example_36_0.png

Passing other matplotlib.pyplot keywords to .plot() methods

We can also pass matplotlib.pyplot keywords to .plot() methods attached to the model input data arrays. For example you can pass a matplotlib colormap (cmap=) keyword to the .plot() method to plot contours of simulated heads over a color flood of hk. We can also use the norm=LogNorm() keyword to use a log color scale when plotting hydraulic conductivity.

Available matplotlib colormaps can be found at https://matplotlib.org/stable/tutorials/colors/colormaps.html

[21]:
from matplotlib.colors import LogNorm

ax = ml.lpf.hk.plot(mflay=2, cmap="GnBu", norm=LogNorm(), colorbar=True)
t = hdobj.plot(
    axes=ax,
    mflay=2,
    masked_values=[-9999.0],
    pcolor=False,
    contour=True,
    colors="black",
)
../_images/Notebooks_plot_array_example_38_0.png
<Figure size 640x480 with 0 Axes>

Plotting data for a package or a model

The input data for a model or an individual package can also be plotted using the .plot() method. The .plot() methods attached to a model or an individual package are meant to provide a method to quickly evaluate model or package input. As a result, there is limited ability to customize the plots. Example of using the .plot() method with a model or and individual packages is demonstrated below.

Plot all data for a package

All input data for a package can be plotted using the .plot() method. Below all of the data for the lpf package is plotted.

[22]:
ml.dis.plot()
[22]:
[<Axes: title={'center': ' model_top'}>,
 <Axes: title={'center': 'botm layer 1'}>,
 <Axes: title={'center': 'botm layer 2'}>,
 <Axes: title={'center': 'botm layer 3'}>,
 <Axes: title={'center': 'botm layer 4'}>,
 <Axes: title={'center': 'botm layer 5'}>,
 <Axes: title={'center': 'botm layer 6'}>,
 <Axes: title={'center': 'botm layer 7'}>,
 <Axes: title={'center': 'botm layer 8'}>,
 <Axes: title={'center': 'botm layer 9'}>,
 <Axes: title={'center': 'botm layer 10'}>,
 <Axes: title={'center': 'botm layer 11'}>,
 <Axes: title={'center': 'botm layer 12'}>,
 <Axes: title={'center': 'botm layer 13'}>,
 <Axes: title={'center': 'botm layer 14'}>,
 <Axes: title={'center': 'botm layer 15'}>,
 <Axes: title={'center': 'botm layer 16'}>]
../_images/Notebooks_plot_array_example_40_1.png
../_images/Notebooks_plot_array_example_40_2.png
../_images/Notebooks_plot_array_example_40_3.png
../_images/Notebooks_plot_array_example_40_4.png
../_images/Notebooks_plot_array_example_40_5.png
../_images/Notebooks_plot_array_example_40_6.png
../_images/Notebooks_plot_array_example_40_7.png
../_images/Notebooks_plot_array_example_40_8.png
../_images/Notebooks_plot_array_example_40_9.png
../_images/Notebooks_plot_array_example_40_10.png
../_images/Notebooks_plot_array_example_40_11.png
../_images/Notebooks_plot_array_example_40_12.png
../_images/Notebooks_plot_array_example_40_13.png
../_images/Notebooks_plot_array_example_40_14.png
../_images/Notebooks_plot_array_example_40_15.png
../_images/Notebooks_plot_array_example_40_16.png
../_images/Notebooks_plot_array_example_40_17.png

Plot package input data for a specified layer

Package input data for a specified layer can be plotted by passing the mflay keyword to the package .plot() method. Below lpf package input data for layer 12 (mflay=11) is plotted.

[23]:
ml.lpf.plot(mflay=11)
[23]:
[<Axes: title={'center': 'hk layer 12'}>,
 <Axes: title={'center': 'hani layer 12'}>,
 <Axes: title={'center': 'vani layer 12'}>,
 <Axes: title={'center': 'ss layer 12'}>,
 <Axes: title={'center': 'sy layer 12'}>,
 <Axes: title={'center': 'vkcb layer 12'}>,
 <Axes: title={'center': 'wetdry layer 12'}>]
../_images/Notebooks_plot_array_example_42_1.png
../_images/Notebooks_plot_array_example_42_2.png
../_images/Notebooks_plot_array_example_42_3.png
../_images/Notebooks_plot_array_example_42_4.png
../_images/Notebooks_plot_array_example_42_5.png
../_images/Notebooks_plot_array_example_42_6.png
../_images/Notebooks_plot_array_example_42_7.png

Plot all input data for a model

All of the input data for a model can be plotted using the .plot() method.

[24]:
ap = ml.plot()
../_images/Notebooks_plot_array_example_44_0.png
../_images/Notebooks_plot_array_example_44_1.png
../_images/Notebooks_plot_array_example_44_2.png
../_images/Notebooks_plot_array_example_44_3.png
../_images/Notebooks_plot_array_example_44_4.png
../_images/Notebooks_plot_array_example_44_5.png
../_images/Notebooks_plot_array_example_44_6.png
../_images/Notebooks_plot_array_example_44_7.png
../_images/Notebooks_plot_array_example_44_8.png
../_images/Notebooks_plot_array_example_44_9.png
../_images/Notebooks_plot_array_example_44_10.png
../_images/Notebooks_plot_array_example_44_11.png
../_images/Notebooks_plot_array_example_44_12.png
../_images/Notebooks_plot_array_example_44_13.png
../_images/Notebooks_plot_array_example_44_14.png
../_images/Notebooks_plot_array_example_44_15.png
../_images/Notebooks_plot_array_example_44_16.png
../_images/Notebooks_plot_array_example_44_17.png
../_images/Notebooks_plot_array_example_44_18.png
../_images/Notebooks_plot_array_example_44_19.png
../_images/Notebooks_plot_array_example_44_20.png
../_images/Notebooks_plot_array_example_44_21.png
../_images/Notebooks_plot_array_example_44_22.png
../_images/Notebooks_plot_array_example_44_23.png
../_images/Notebooks_plot_array_example_44_24.png
../_images/Notebooks_plot_array_example_44_25.png
../_images/Notebooks_plot_array_example_44_26.png
../_images/Notebooks_plot_array_example_44_27.png
../_images/Notebooks_plot_array_example_44_28.png
../_images/Notebooks_plot_array_example_44_29.png
../_images/Notebooks_plot_array_example_44_30.png
../_images/Notebooks_plot_array_example_44_31.png
../_images/Notebooks_plot_array_example_44_32.png
../_images/Notebooks_plot_array_example_44_33.png
../_images/Notebooks_plot_array_example_44_34.png
../_images/Notebooks_plot_array_example_44_35.png
../_images/Notebooks_plot_array_example_44_36.png
../_images/Notebooks_plot_array_example_44_37.png
../_images/Notebooks_plot_array_example_44_38.png
../_images/Notebooks_plot_array_example_44_39.png
../_images/Notebooks_plot_array_example_44_40.png
../_images/Notebooks_plot_array_example_44_41.png
../_images/Notebooks_plot_array_example_44_42.png
../_images/Notebooks_plot_array_example_44_43.png
../_images/Notebooks_plot_array_example_44_44.png
../_images/Notebooks_plot_array_example_44_45.png
../_images/Notebooks_plot_array_example_44_46.png
../_images/Notebooks_plot_array_example_44_47.png
../_images/Notebooks_plot_array_example_44_48.png
../_images/Notebooks_plot_array_example_44_49.png
../_images/Notebooks_plot_array_example_44_50.png
../_images/Notebooks_plot_array_example_44_51.png
../_images/Notebooks_plot_array_example_44_52.png
../_images/Notebooks_plot_array_example_44_53.png
../_images/Notebooks_plot_array_example_44_54.png
../_images/Notebooks_plot_array_example_44_55.png
../_images/Notebooks_plot_array_example_44_56.png
../_images/Notebooks_plot_array_example_44_57.png
../_images/Notebooks_plot_array_example_44_58.png
../_images/Notebooks_plot_array_example_44_59.png
../_images/Notebooks_plot_array_example_44_60.png
../_images/Notebooks_plot_array_example_44_61.png
../_images/Notebooks_plot_array_example_44_62.png
../_images/Notebooks_plot_array_example_44_63.png
../_images/Notebooks_plot_array_example_44_64.png
../_images/Notebooks_plot_array_example_44_65.png
../_images/Notebooks_plot_array_example_44_66.png
../_images/Notebooks_plot_array_example_44_67.png
../_images/Notebooks_plot_array_example_44_68.png
../_images/Notebooks_plot_array_example_44_69.png
../_images/Notebooks_plot_array_example_44_70.png
../_images/Notebooks_plot_array_example_44_71.png
../_images/Notebooks_plot_array_example_44_72.png
../_images/Notebooks_plot_array_example_44_73.png
../_images/Notebooks_plot_array_example_44_74.png
../_images/Notebooks_plot_array_example_44_75.png
../_images/Notebooks_plot_array_example_44_76.png
../_images/Notebooks_plot_array_example_44_77.png
../_images/Notebooks_plot_array_example_44_78.png
../_images/Notebooks_plot_array_example_44_79.png
../_images/Notebooks_plot_array_example_44_80.png
../_images/Notebooks_plot_array_example_44_81.png
../_images/Notebooks_plot_array_example_44_82.png
../_images/Notebooks_plot_array_example_44_83.png
../_images/Notebooks_plot_array_example_44_84.png
../_images/Notebooks_plot_array_example_44_85.png
../_images/Notebooks_plot_array_example_44_86.png
../_images/Notebooks_plot_array_example_44_87.png
../_images/Notebooks_plot_array_example_44_88.png
../_images/Notebooks_plot_array_example_44_89.png
../_images/Notebooks_plot_array_example_44_90.png
../_images/Notebooks_plot_array_example_44_91.png
../_images/Notebooks_plot_array_example_44_92.png
../_images/Notebooks_plot_array_example_44_93.png
../_images/Notebooks_plot_array_example_44_94.png
../_images/Notebooks_plot_array_example_44_95.png
../_images/Notebooks_plot_array_example_44_96.png
../_images/Notebooks_plot_array_example_44_97.png
../_images/Notebooks_plot_array_example_44_98.png
../_images/Notebooks_plot_array_example_44_99.png
../_images/Notebooks_plot_array_example_44_100.png
../_images/Notebooks_plot_array_example_44_101.png
../_images/Notebooks_plot_array_example_44_102.png
../_images/Notebooks_plot_array_example_44_103.png
../_images/Notebooks_plot_array_example_44_104.png
../_images/Notebooks_plot_array_example_44_105.png
../_images/Notebooks_plot_array_example_44_106.png
../_images/Notebooks_plot_array_example_44_107.png
../_images/Notebooks_plot_array_example_44_108.png
../_images/Notebooks_plot_array_example_44_109.png
../_images/Notebooks_plot_array_example_44_110.png
../_images/Notebooks_plot_array_example_44_111.png
../_images/Notebooks_plot_array_example_44_112.png
../_images/Notebooks_plot_array_example_44_113.png
../_images/Notebooks_plot_array_example_44_114.png
../_images/Notebooks_plot_array_example_44_115.png
../_images/Notebooks_plot_array_example_44_116.png
../_images/Notebooks_plot_array_example_44_117.png
../_images/Notebooks_plot_array_example_44_118.png
../_images/Notebooks_plot_array_example_44_119.png
../_images/Notebooks_plot_array_example_44_120.png
../_images/Notebooks_plot_array_example_44_121.png
../_images/Notebooks_plot_array_example_44_122.png
../_images/Notebooks_plot_array_example_44_123.png
../_images/Notebooks_plot_array_example_44_124.png
../_images/Notebooks_plot_array_example_44_125.png
../_images/Notebooks_plot_array_example_44_126.png
../_images/Notebooks_plot_array_example_44_127.png
../_images/Notebooks_plot_array_example_44_128.png
../_images/Notebooks_plot_array_example_44_129.png
../_images/Notebooks_plot_array_example_44_130.png
../_images/Notebooks_plot_array_example_44_131.png
../_images/Notebooks_plot_array_example_44_132.png
../_images/Notebooks_plot_array_example_44_133.png
../_images/Notebooks_plot_array_example_44_134.png
../_images/Notebooks_plot_array_example_44_135.png
../_images/Notebooks_plot_array_example_44_136.png
../_images/Notebooks_plot_array_example_44_137.png
../_images/Notebooks_plot_array_example_44_138.png
../_images/Notebooks_plot_array_example_44_139.png
../_images/Notebooks_plot_array_example_44_140.png
../_images/Notebooks_plot_array_example_44_141.png
../_images/Notebooks_plot_array_example_44_142.png
../_images/Notebooks_plot_array_example_44_143.png
../_images/Notebooks_plot_array_example_44_144.png
../_images/Notebooks_plot_array_example_44_145.png
../_images/Notebooks_plot_array_example_44_146.png
../_images/Notebooks_plot_array_example_44_147.png
../_images/Notebooks_plot_array_example_44_148.png
../_images/Notebooks_plot_array_example_44_149.png
../_images/Notebooks_plot_array_example_44_150.png
../_images/Notebooks_plot_array_example_44_151.png
../_images/Notebooks_plot_array_example_44_152.png
../_images/Notebooks_plot_array_example_44_153.png
../_images/Notebooks_plot_array_example_44_154.png
../_images/Notebooks_plot_array_example_44_155.png
../_images/Notebooks_plot_array_example_44_156.png
../_images/Notebooks_plot_array_example_44_157.png
../_images/Notebooks_plot_array_example_44_158.png
../_images/Notebooks_plot_array_example_44_159.png
../_images/Notebooks_plot_array_example_44_160.png
../_images/Notebooks_plot_array_example_44_161.png
../_images/Notebooks_plot_array_example_44_162.png
../_images/Notebooks_plot_array_example_44_163.png
../_images/Notebooks_plot_array_example_44_164.png
../_images/Notebooks_plot_array_example_44_165.png
../_images/Notebooks_plot_array_example_44_166.png
../_images/Notebooks_plot_array_example_44_167.png
../_images/Notebooks_plot_array_example_44_168.png
../_images/Notebooks_plot_array_example_44_169.png
../_images/Notebooks_plot_array_example_44_170.png
../_images/Notebooks_plot_array_example_44_171.png
../_images/Notebooks_plot_array_example_44_172.png
../_images/Notebooks_plot_array_example_44_173.png
../_images/Notebooks_plot_array_example_44_174.png
../_images/Notebooks_plot_array_example_44_175.png
../_images/Notebooks_plot_array_example_44_176.png
../_images/Notebooks_plot_array_example_44_177.png
../_images/Notebooks_plot_array_example_44_178.png
../_images/Notebooks_plot_array_example_44_179.png
../_images/Notebooks_plot_array_example_44_180.png
../_images/Notebooks_plot_array_example_44_181.png
../_images/Notebooks_plot_array_example_44_182.png
../_images/Notebooks_plot_array_example_44_183.png
../_images/Notebooks_plot_array_example_44_184.png
../_images/Notebooks_plot_array_example_44_185.png
../_images/Notebooks_plot_array_example_44_186.png
../_images/Notebooks_plot_array_example_44_187.png
../_images/Notebooks_plot_array_example_44_188.png
../_images/Notebooks_plot_array_example_44_189.png
../_images/Notebooks_plot_array_example_44_190.png
../_images/Notebooks_plot_array_example_44_191.png
../_images/Notebooks_plot_array_example_44_192.png
../_images/Notebooks_plot_array_example_44_193.png
../_images/Notebooks_plot_array_example_44_194.png
../_images/Notebooks_plot_array_example_44_195.png
../_images/Notebooks_plot_array_example_44_196.png
../_images/Notebooks_plot_array_example_44_197.png
../_images/Notebooks_plot_array_example_44_198.png
../_images/Notebooks_plot_array_example_44_199.png
../_images/Notebooks_plot_array_example_44_200.png
../_images/Notebooks_plot_array_example_44_201.png
../_images/Notebooks_plot_array_example_44_202.png
../_images/Notebooks_plot_array_example_44_203.png
../_images/Notebooks_plot_array_example_44_204.png
../_images/Notebooks_plot_array_example_44_205.png
../_images/Notebooks_plot_array_example_44_206.png
../_images/Notebooks_plot_array_example_44_207.png
../_images/Notebooks_plot_array_example_44_208.png
../_images/Notebooks_plot_array_example_44_209.png

Plot model input data for a specified layer

Model input data for a specified layer can be plotted by passing the mflay keyword to the package .plot() method. Below model input data for layer 12 (mflay=11) is plotted.

[25]:
ap = ml.plot(mflay=11)
../_images/Notebooks_plot_array_example_46_0.png
../_images/Notebooks_plot_array_example_46_1.png
../_images/Notebooks_plot_array_example_46_2.png
../_images/Notebooks_plot_array_example_46_3.png
../_images/Notebooks_plot_array_example_46_4.png
../_images/Notebooks_plot_array_example_46_5.png
../_images/Notebooks_plot_array_example_46_6.png
../_images/Notebooks_plot_array_example_46_7.png
../_images/Notebooks_plot_array_example_46_8.png
../_images/Notebooks_plot_array_example_46_9.png
../_images/Notebooks_plot_array_example_46_10.png
../_images/Notebooks_plot_array_example_46_11.png
../_images/Notebooks_plot_array_example_46_12.png
../_images/Notebooks_plot_array_example_46_13.png
../_images/Notebooks_plot_array_example_46_14.png

This notebook demonstrates some of the simple plotting functionality available with flopy. Although not described here, the plotting functionality tries to be general by passing keyword arguments passed to the plot() and plot_data() methods down into the matplotlib.pyplot routines that do the actual plotting. For those looking to customize these plots, it may be necessary to search for the available keywords. The plot() method return the matplotlib.pyplot axis objects that are created (or passed). These axes objects can be used to plot additional data (except when plots are saved as image files).

Hope this gets you started!

[26]:
try:
    # ignore PermissionError on Windows
    temp_dir.cleanup()
except:
    pass