contour

contour(x, y, z)
contour(z::Matrix)

Creates a contour plot of the plane spanning x::Vector, y::Vector, z::Matrix If only z::Matrix is supplied, the indices of the elements in z will be used as the x and y locations when plotting the contour.

The attribute levels can be either

an Int that produces n equally wide levels or bands

an AbstractVector{<:Real} that lists n consecutive edges from low to high, which result in n-1 levels or bands

Attributes

Available attributes and their defaults for MakieCore.Combined{Makie.contour, T} where T are:

  alpha           1.0
  ambient         Float32[0.55, 0.55, 0.55]
  color           "nothing"
  colormap        :viridis
  colorrange      MakieCore.Automatic()
  diffuse         Float32[0.4, 0.4, 0.4]
  fillrange       false
  inspectable     true
  levels          5
  lightposition   :eyeposition
  linewidth       1.0
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  shininess       32.0f0
  specular        Float32[0.2, 0.2, 0.2]
  ssao            false
  transparency    false
  visible         true

Examples

using CairoMakie

f = Figure()
Axis(f[1, 1])

xs = LinRange(0, 10, 100)
ys = LinRange(0, 15, 100)
zs = [cos(x) * sin(y) for x in xs, y in ys]

contour!(xs, ys, zs)

f

Omitting the xs and ys results in the indices of zs being used. We can also set arbitrary contour-levels using levels

using CairoMakie

f = Figure()
Axis(f[1, 1])

xs = LinRange(0, 10, 100)
ys = LinRange(0, 15, 100)
zs = [cos(x) * sin(y) for x in xs, y in ys]

contour!(zs,levels=-1:0.1:1)

f