Skip to content

ModiaSim/ModiaPlot_PyPlot.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ModiaPlot_PyPlot

Stable The MIT License

ModiaPlot_PyPlot is part of ModiaSim and provides convenient line plots of simulation results with package PyPlot (= a Julia interface to the Matplotlib plotting library from Python, and specifically to the matplotlib.pyplot module).

ModiaPlot_PyPlot is typically not directly used, but is activated via package ModiaResult. For details of the installation and the usage, see the ModiaResult documentation.

Example

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 PyPlot selected for plotting,

import ModiaResult

# Define plotting software globally
ModiaResult.usePlotPackage("PyPlot") # or ENV["MODIA_PLOT"] = "PyPlot"
                
# Execute "using ModiaPlot_PyPlot"                              
ModiaResult.@usingModiaPlot

then the following command

plot(result, [("sigA", "sigB", "sigC"), "r[2:3]"])

generates the following image (layout and legends are automatically constructed):

SegmentedSignalsPlot

Main developer

Martin Otter, DLR - Institute of System Dynamics and Control

About

Convenient line plots of ModiaResults with PyPlot

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages