6fbec8f3创建于 2022年6月24日历史提交

Filled Contour

Examples

  1. Plot the filled contour of the peaks function.

::

let x = linspace(-3.0, 3.0, num: 50)
let (X, Y, Z) = meshgrid(x, x, peaks)
contourf(X, Y, Z)

Result:

.. image:: ../../../tests/imgs/contourf/contourf_1.png :align: center :width: 360

  1. Plot filled contour with 10 level sets.

::

let x = linspace(-2.0 * PI64, 2.0 * PI64, num: 50)
let y = linspace(0.0, 4.0 * PI64, num: 50)
let (X, Y, Z) = meshgrid(x, y, {x: Float64, y: Float64 => sin(x) + cos(y)})
contourf(X, Y, Z, 10)

Result:

.. image:: ../../../tests/imgs/contourf/contourf_2.png :align: center :width: 360

  1. Plot filled contour with labels for level sets.

::

let x = linspace(-3.0, 3.0, num: 50)
let (X, Y, Z) = meshgrid(x, x, peaks)
contourf(X, Y, Z, vector([2.0, 3.0])).contour_text(true)

Result:

.. image:: ../../../tests/imgs/contourf/contourf_3.png :align: center :width: 360

  1. Plot filled contour with a single level set.

::

let x = linspace(-3.0, 3.0, num: 50)
let (X, Y, Z) = meshgrid(x, x, peaks)
contourf(X, Y, Z, vector([2.0]))

Result:

.. image:: ../../../tests/imgs/contourf/contourf_4.png :align: center :width: 360

  1. Plot filled contour with dashed lines.

::

let x = linspace(-3.0, 3.0, num: 50)
let (X, Y, Z) = meshgrid(x, x, peaks)
contourf(X, Y, Z, line_spec:"--")

Result:

.. image:: ../../../tests/imgs/contourf/contourf_5.png :align: center :width: 360

  1. Plot filled contour with custom line width.

::

let x = linspace(-3.0, 3.0, num: 50)
let (X, Y, Z) = meshgrid(x, x, peaks)
contourf(X, Y, Z).line_width(3.0)

Result:

.. image:: ../../../tests/imgs/contourf/contourf_6.png :align: center :width: 360