Usage#
The standard approach to use ContourPy is to:
Call
contour_generator()
passing your 2Dz
array and optionalx
andy
arrays as arguments to return aContourGenerator
object, such as the defaultSerialContourGenerator
.Call
ContourGenerator
member functionslines()
and/orfilled()
repeatedly to calculate and return contours for that (x, y, z) grid:
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.