stairs

Makie.stairsFunction
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 Combined{Makie.stairs, T} where T are:

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

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