contourf

AbstractPlotting.contourfFunction
contourf(xs, ys, zs; kwargs...)

Plots a filled contour of the height information in zs at horizontal grid positions xs and vertical grid positions ys.

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

If you want to show a band from -Inf to the low edge, set extendlow to :auto for the same color as the first level, or specify a different color (default nothing means no extended band) If you want to show a band from the high edge to Inf, set extendhigh to :auto for the same color as the last level, or specify a different color (default nothing means no extended band)

Attributes

Available attributes and their defaults for Contourf{T} where T are:

  colormap    :viridis
  extendhigh  "nothing"
  extendlow   "nothing"
  levels      10
source
using CairoMakie

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

f = Figure(resolution = (800, 600))
Axis(f[1, 1])

co = contourf!(xs, ys, zs, levels = 10)

Colorbar(f[1, 2], co, width = 20)

f
using CairoMakie

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

f = Figure(resolution = (800, 600))
Axis(f[1, 1])

co = contourf!(xs, ys, zs, levels = -0.75:0.25:0.5,
    extendlow = :cyan, extendhigh = :magenta)

Colorbar(f[1, 2], co, width = 20)

f
using CairoMakie

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

f = Figure(resolution = (800, 600))
Axis(f[1, 1])

co = contourf!(xs, ys, zs,
    levels = -0.75:0.25:0.5,
    extendlow = :auto, extendhigh = :auto)

Colorbar(f[1, 2], co, width = 20)

f