UsageΒΆ
The standard approach to use ContourPy is to:
Call
contour_generator()passing your 2Dzarray and optionalxandyarrays as arguments to return aContourGeneratorobject, such as the defaultSerialContourGenerator. There are many arguments forcontour_generator()but onlyzis compulsory and there are sensible defaults for the others.To calculate contour lines at a particular z-level call
ContourGeneratormember functionlines(). To calculate contour lines at multiple levels either repeatedly calllines()or usemulti_lines()instead.To calculate filled contours (polygons) between two z-levels call
ContourGeneratormember functionfilled(). To calculate filled contours between multiple pairs of z-levels either repeatedly callfilled()or usemulti_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.