Other functions#

contourpy.convert_filled(filled, fill_type_from, fill_type_to)[source]#

Return the specified filled contours converted to a different FillType.

Parameters:
  • filled (sequence of arrays) – Filled contour polygons to convert.

  • fill_type_from (FillType or str) – FillType to convert from as enum or string equivalent.

  • fill_type_to (FillType or str) – FillType to convert to as enum or string equivalent.

Returns:

Converted filled contour polygons.

When converting non-chunked fill types (FillType.OuterCode or FillType.OuterOffset) to chunked ones, all polygons are placed in the first chunk. When converting in the other direction, all chunk information is discarded. Converting a fill type that is not aware of the relationship between outer boundaries and contained holes (FillType.ChunkCombinedCode or) FillType.ChunkCombinedOffset) to one that is will raise a ValueError.

New in version 1.2.0.

contourpy.convert_lines(lines, line_type_from, line_type_to)[source]#

Return the specified contour lines converted to a different LineType.

Parameters:
  • lines (sequence of arrays) – Contour lines to convert.

  • line_type_from (LineType or str) – LineType to convert from as enum or string equivalent.

  • line_type_to (LineType or str) – LineType to convert to as enum or string equivalent.

Returns:

Converted contour lines.

When converting non-chunked line types (LineType.Separate or LineType.SeparateCode) to chunked ones (LineType.ChunkCombinedCode, LineType.ChunkCombinedOffset or LineType.ChunkCombinedNan), all lines are placed in the first chunk. When converting in the other direction, all chunk information is discarded.

New in version 1.2.0.

contourpy.convert_multi_filled(multi_filled, fill_type_from, fill_type_to)[source]#

New in version 1.3.0.

contourpy.convert_multi_lines(multi_lines, line_type_from, line_type_to)[source]#

New in version 1.3.0.

contourpy.dechunk_filled(filled, fill_type)[source]#

Return the specified filled contours with all chunked data moved into the first chunk.

Filled contours that are not chunked (FillType.OuterCode and FillType.OuterOffset) and those that are but only contain a single chunk are returned unmodified. Individual polygons are unchanged, they are not geometrically combined.

Parameters:
  • filled (sequence of arrays) – Filled contour data as returned by filled().

  • fill_type (FillType or str) – Type of filled() as enum or string equivalent.

Returns:

Filled contours in a single chunk.

New in version 1.2.0.

contourpy.dechunk_lines(lines, line_type)[source]#

Return the specified contour lines with all chunked data moved into the first chunk.

Contour lines that are not chunked (LineType.Separate and LineType.SeparateCode) and those that are but only contain a single chunk are returned unmodified. Individual lines are unchanged, they are not geometrically combined.

Parameters:
  • lines (sequence of arrays) – Contour line data as returned by lines().

  • line_type (LineType or str) – Type of lines() as enum or string equivalent.

Returns:

Contour lines in a single chunk.

New in version 1.2.0.

contourpy.dechunk_multi_filled(multi_filled, fill_type)[source]#

New in version 1.3.0.

contourpy.dechunk_multi_lines(multi_lines, line_type)[source]#

New in version 1.3.0.

contourpy.max_threads() int#

Return the maximum number of threads, obtained from std::thread::hardware_concurrency().

This is the number of threads used by a multithreaded ContourGenerator if the kwarg threads=0 is passed to contour_generator().