stairs

stairs(xs, ys; kwargs...)

Plot a stair function.

The step parameter can take the following values:

  • :pre: horizontal part of step extends to the left of each value in xs.

  • :post: horizontal part of step extends to the right of each value in xs.

  • :center: horizontal part of step extends halfway between the two adjacent values of xs.

The conversion trait of stem is PointBased.

Attributes

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

  color           :black
  colormap        :viridis
  colorrange      MakieCore.Automatic()
  cycle           [:color]
  depth_shift     0.0f0
  diffuse         Float32[0.4, 0.4, 0.4]
  inspectable     true
  linestyle       "nothing"
  linewidth       1.5
  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
  step            :pre
  transparency    false
  visible         true

Examples

using CairoMakie

f = Figure()

xs = LinRange(0, 4pi, 21)
ys = sin.(xs)

stairs(f[1, 1], xs, ys)
stairs(f[2, 1], xs, ys; step=:post, color=:blue, linestyle=:dash)
stairs(f[3, 1], xs, ys; step=:center, color=:red, linestyle=:dot)

f