Skip to content

Commit 037e406

Browse files
committed
add docs
1 parent b860cc8 commit 037e406

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

docs/src/lib/plotting.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,51 @@ Pages = ["plotting.md"]
88
!!! note "Time-domain responses"
99
There are no special functions to plot time-domain results, such as step and impulse responses, instead, simply call `plot` on the result structure (`ControlSystemsBase.SimResult`) returned by [`lsim`](@ref), [`step`](@ref), [`impulse`](@ref) etc.
1010

11+
## Makie support
12+
!!! danger "Experimental"
13+
14+
The support for plotting with Makie is currently experimental and at any time subject to breaking changes or removal **not** respecting semantic versioning.
15+
16+
ControlSystemsBase provides experimental support for plotting with [Makie.jl](https://docs.makie.org/) through the `CSMakie` module. This support is loaded automatically when you load a Makie backend (GLMakie, CairoMakie, or WGLMakie).
17+
18+
### Usage
19+
20+
```julia
21+
using ControlSystemsBase, GLMakie # or CairoMakie, WGLMakie
22+
23+
# Create a system
24+
P = tf([1], [1, 2, 1])
25+
26+
# Use CSMakie plotting functions
27+
CSMakie.bodeplot(P)
28+
CSMakie.nyquistplot(P)
29+
CSMakie.pzmap(P)
30+
# ... and more
31+
32+
# Direct plotting of simulation results
33+
res = step(P, 10)
34+
plot(res) # Creates a figure with time-domain response
35+
36+
si = stepinfo(res)
37+
plot(si) # Visualizes step response characteristics
38+
```
39+
40+
### Available functions
41+
42+
The `CSMakie` module provides Makie implementations of the following plotting functions:
43+
44+
- `CSMakie.bodeplot` - Bode magnitude and phase plots
45+
- `CSMakie.nyquistplot` - Nyquist plots with optional M and Mt circles
46+
- `CSMakie.sigmaplot` - Singular value plots
47+
- `CSMakie.marginplot` - Gain and phase margin plots
48+
- `CSMakie.pzmap` - Pole-zero maps
49+
- `CSMakie.nicholsplot` - Nichols charts
50+
- `CSMakie.rgaplot` - Relative gain array plots
51+
- `CSMakie.rlocusplot` - Root locus plots
52+
- `CSMakie.leadlinkcurve` - Lead-link design curves
53+
54+
Additionally, `SimResult` and `StepInfo` types can be plotted directly using Makie's `plot` function.
55+
1156
# Plotting functions
1257

1358
```@autodocs

lib/ControlSystemsBase/test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ my_tests = [
4646
"test_demo_systems",
4747
"test_autovec",
4848
"test_plots",
49+
"test_makie_plots",
4950
"test_dsp",
5051
"test_implicit_diff",
5152
"test_rootlocus",

0 commit comments

Comments
 (0)