Other functions

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

Convert filled contours from one FillType to another.

Parameters:
  • filled (sequence of arrays) – Filled contour polygons to convert, such as those returned by ContourGenerator.filled().

  • 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.

Added in version 1.2.0.

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

Convert contour lines from one LineType to another.

Parameters:
  • lines (sequence of arrays) – Contour lines to convert, such as those returned by ContourGenerator.lines().

  • 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.

Added in version 1.2.0.

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

Convert multiple sets of filled contours from one FillType to another.

Parameters:
  • multi_filled (nested sequence of arrays) – Filled contour polygons to convert, such as those returned by ContourGenerator.multi_filled().

  • 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 sets 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.

Added in version 1.3.0.

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

Convert multiple sets of contour lines from one LineType to another.

Parameters:
Returns:

Converted set of 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.

Added in version 1.3.0.

contourpy.dechunk_filled(filled, fill_type)[source]

Return the specified filled contours with 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:
Returns:

Filled contours in a single chunk.

Added in version 1.2.0.

contourpy.dechunk_lines(lines, line_type)[source]

Return the specified contour lines with 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:
Returns:

Contour lines in a single chunk.

Added in version 1.2.0.

contourpy.dechunk_multi_filled(multi_filled, fill_type)[source]

Return multiple sets of filled contours with chunked data moved into the first chunks.

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:
Returns:

Multiple sets of filled contours in a single chunk.

Added in version 1.3.0.

contourpy.dechunk_multi_lines(multi_lines, line_type)[source]

Return multiple sets of contour lines with all chunked data moved into the first chunks.

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:
Returns:

Multiple sets of contour lines in a single chunk.

Added 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().