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 Combined{Makie.contour} are:

  alpha           1.0
  color           "nothing"
  colormap        :viridis
  colorrange      MakieCore.Automatic()
  depth_shift     0.0f0
  diffuse         Float32[0.4, 0.4, 0.4]
  enable_depth    true
  inspectable     true
  levels          5
  linestyle       "nothing"
  linewidth       1.0
  nan_color       RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.0f0)
  overdraw        false
  shininess       32.0f0
  space           :data
  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