Usage

The standard approach to use contourpy is to:

  1. Call contour_generator() passing your 2D z array and optional x and y arrays as arguments to return a ContourGenerator object, such as the default SerialContourGenerator.

  2. Call ContourGenerator member functions lines() and/or filled() repeatedly to calculate and return contours for that (x, y, z) grid:

    1. lines() calculates contour lines at a particular z-level.

    2. filled() calculates filled contours (polygons) between two z-levels.

There are many arguments for contour_generator() but only z is compulsory and there are sensible defaults for the others.

Note

Although it is possible to create objects of classes derived from ContourGenerator directly from the pybind11-wrapped C++ code in wrap.cpp, this is discouraged as contour_generator() provides better argument checking and also support for numpy masked z arrays.

There are some utility functions in the contourpy.util module for testing and examples, including producing graphical output using Matplotlib and Bokeh.