Skip to content

Commit 03cbb43

Browse files
committed
Switch to CairoMakie in tests
1 parent dd15a6b commit 03cbb43

File tree

4 files changed

+53
-47
lines changed

4 files changed

+53
-47
lines changed

docs/src/lib/plotting.md

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,6 @@ 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.
5511

5612
# Plotting functions
5713

@@ -160,3 +116,49 @@ res = step(sysd, 5)
160116
plot(res, l=(:dash, 4))
161117
# plot!(stepinfo(step(sysd[1,1], 5))) # adds extra info to the plot
162118
```
119+
120+
121+
## Makie support
122+
!!! danger "Experimental"
123+
124+
The support for plotting with Makie is currently experimental and at any time subject to breaking changes or removal **not** respecting semantic versioning.
125+
126+
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).
127+
128+
### Usage
129+
130+
```julia
131+
using ControlSystemsBase, GLMakie # or CairoMakie, WGLMakie
132+
133+
# Create a system
134+
P = tf([1], [1, 2, 1])
135+
136+
# Use CSMakie plotting functions
137+
CSMakie.bodeplot(P)
138+
CSMakie.nyquistplot(P)
139+
CSMakie.pzmap(P)
140+
# ... and more
141+
142+
# Direct plotting of simulation results
143+
res = step(P, 10)
144+
plot(res) # Creates a figure with time-domain response
145+
146+
si = stepinfo(res)
147+
plot(si) # Visualizes step response characteristics
148+
```
149+
150+
### Available functions
151+
152+
The `CSMakie` module provides Makie implementations of the following plotting functions:
153+
154+
- `CSMakie.bodeplot` - Bode magnitude and phase plots
155+
- `CSMakie.nyquistplot` - Nyquist plots with optional M and Mt circles
156+
- `CSMakie.sigmaplot` - Singular value plots
157+
- `CSMakie.marginplot` - Gain and phase margin plots
158+
- `CSMakie.pzmap` - Pole-zero maps
159+
- `CSMakie.nicholsplot` - Nichols charts
160+
- `CSMakie.rgaplot` - Relative gain array plots
161+
- `CSMakie.rlocusplot` - Root locus plots
162+
- `CSMakie.leadlinkcurve` - Lead-link design curves
163+
164+
Additionally, `SimResult` and `StepInfo` types can be plotted directly using Makie's `plot` function.

lib/ControlSystemsBase/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ julia = "1.6"
5353

5454
[extras]
5555
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
56+
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
5657
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
5758
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
5859
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
5960
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
60-
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
6161
GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
6262
GenericSchur = "c145ed77-6b09-5dd9-b285-bf645a82121e"
6363
ImplicitDifferentiation = "57b37032-215b-411a-8a7c-41a003a55207"
@@ -68,4 +68,4 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
6868
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
6969

7070
[targets]
71-
test = ["Test", "Aqua", "ComponentArrays", "Documenter", "DSP", "FiniteDifferences", "ImplicitDifferentiation", "Makie", "GLMakie", "GenericSchur", "GR", "Plots", "SparseArrays", "StaticArrays"]
71+
test = ["Test", "Aqua", "ComponentArrays", "Documenter", "DSP", "FiniteDifferences", "ImplicitDifferentiation", "Makie", "CairoMakie", "GenericSchur", "GR", "Plots", "SparseArrays", "StaticArrays"]

lib/ControlSystemsBase/src/CSMakie.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ CSMakie.nyquistplot(sys)
1313
```
1414
1515
All functions will throw an informative error if called without Makie.jl loaded.
16+
17+
!!! danger "Experimental"
18+
19+
The support for plotting with Makie is currently experimental and at any time subject to breaking changes or removal **not** respecting semantic versioning.
1620
"""
1721
module CSMakie
1822

lib/ControlSystemsBase/test/test_makie_plots.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using ControlSystemsBase
22
using Test
33
using LinearAlgebra
4-
using GLMakie
4+
using CairoMakie
55

66
@testset "Makie Plot Tests" begin
77
# Create test systems

0 commit comments

Comments
 (0)