This package provides the following features:
- the parameters of the plot commands are stored in a struct and returned
- this struct can be displayed again or stored in a file and loaded later
- an oscilloscope-like plot with multiple channels can be created
with the
plotx()
function - an XY plot can be created with the
plotxy()
function
- add support for PythonPlot
- allow changing of the caption
- the
save()
function should allow storing a plot as jld2, pdf or png file - add bode plots
First, install matplotlib:
sudo apt install python3-matplotlib
If not done yet, create a project:
mkdir MyProject
cd MyProject
julia --project="."
and install ControlPlots
using Pkg
pkg"add https://github.com/aenarete/ControlPlots.jl"
If not done yet, create a project:
mkdir MyProject
cd MyProject
julia --project="."
Install Python, matplotlib and ControlPlots
using Pkg
ENV["PYTHON"]=""
pkg"add https://github.com/aenarete/ControlPlots.jl"
Launch Julia with julia --project
. Then execute:
using ControlPlots
X = 0:0.1:2pi
Y = sin.(X)
p = plot(X, Y, xlabel="X", ylabel="sin", fig="basic")
A plot window should pop up.
You can now close the plot window. You can re-display the plot by typing:
p
You can also save the plot under a name of your choice:
save("plot.jld2", p)
Now you restart Julia and load it with:
p = load("plot.jld2")
The plot is automatically displayed.
using ControlPlots
T = 0:0.1:2pi
Y1 = sin.(T)
Y2 = cos.(T)
p = plotx(T, Y1, Y2; ylabels=["Y1", "Y2"], fig="dual")
using ControlPlots
T = 0:0.1:2pi+0.1
X = sin.(T)
Y = cos.(T)
p = plotxy(X, Y, xlabel="X", ylabel="Y", fig="xy")
You can plot multiple time series in one plot, e.g. like this:
using ControlPlots
x = 1.5*ones(11)
y = 1:0.1:2
out = min.(x, y)
plot(1:11, [x, y, out]; labels=["input_a", "input_b", "output"], fig="2-in-one")