ModiaPlot_CairoMakie is part of ModiaSim and provides convenient line plots of simulation results with package CairoMakie.
ModiaPlot_CairoMakie is typically not directly used, but is activated via package ModiaResult. For details of the installation and the usage, see the ModiaResult documentation.
Once a result data structure result
with signals sigA(t), sigB(t), sigC(t), r[3](t)
:
# │ name unit nTime signalType valueSize eltype
───┼─────────────────────────────────────────────────────────────
1 │ time 2 Independent () Float64
2 │ sigA m 88 Continuous () Float64
3 │ sigB m s^-1 151 Continuous () Float64
4 │ sigC m N 16 Clocked () Float64
5 │ r m 72 Continuous (3,) Vector{Float64}
is available and CairoMakie
selected for plotting,
import ModiaResult
# Define plotting software globally
ModiaResult.usePlotPackage("CairoMakie") # or ENV["MODIA_PLOT"] = "CairoMakie"
# Execute "using ModiaPlot_CairoMakie"
ModiaResult.@usingModiaPlot
then the following command
plot(result, [("sigA", "sigB", "sigC"), "r[2:3]"], figure=2)
saveFigure(2, "segmented-signals-plot.svg")
generates the following image (layout and legends are automatically constructed):
Martin Otter, DLR - Institute of System Dynamics and Control