Skip to content

Recipes

TimeseriesMakie.trajectory Function
julia
trajectory(x, y, [z]; kwargs...)

Plots a colored trajectory in 2D or 3D space.

Key attribtues:

color = :speed: The coloring method for the trajectory.

Can be one of:

  • :speed: Color by speed along the trajectory

  • :time: Color by time index

  • <: AbstractVector: Color by a custom vector of values

  • Union{<:Symbol, <:Colorant}: Color by a fixed color

Other attributes are shared with Makie.Lines.

Plot type

The plot type alias for the trajectory function is Trajectory.

source
julia
f = Figure(size = (600, 600))

ϕ = 0:0.1:() |> reverse
x = ϕ .* exp.(ϕ .* im)
y = imag.(x)
x = real.(x)

# * Default
ax = Axis(f[1, 1], title = "Default")
trajectory!(ax, x, y)

# * Speed
ax = Axis(f[1, 2], title = "Speed")
trajectory!(ax, x, y; color = :speed)

# * Alpha
ax = Axis(f[2, 1], title = "Time")
trajectory!(ax, x, y; color = :time)

# * 3D
ax = Axis3(f[2, 2], title = "3D")
trajectory!(ax, x, y, x .* y; color = :speed)

f