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. There are many arguments for contour_generator() but only z is compulsory and there are sensible defaults for the others.

  2. To calculate contour lines at a particular z-level call ContourGenerator member function lines(). To calculate contour lines at multiple levels either repeatedly call lines() or use multi_lines() instead.

  3. To calculate filled contours (polygons) between two z-levels call ContourGenerator member function filled(). To calculate filled contours between multiple pairs of z-levels either repeatedly call filled() or use multi_filled() instead.

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.