Axis-like objects

Axis-like objects

Simple group plot


cs = [[(0,0), (1,1), (2,2)],
      [(0,2), (1,1), (2,0)],
      [(0,2), (1,1), (2,1)],
      [(0,2), (1,1), (1,0)]]

@pgf gp = GroupPlot(
    {
        group_style = { group_size = "2 by 2",},
        height = "4cm",
        width = "4cm"
    }
)

@pgf for (i, coords) in enumerate(cs)
    push!(gp, {title = i})
    push!(gp, PlotInc(Coordinates(coords)))
end
gp

[.pdf], [generated .tex]

Multiple group plots

Each set of options (here, empty {}) starts a new set of axes.

x = range(0; stop =2*pi, length = 100)
@pgf GroupPlot(
    {
        group_style =
        {
            group_size="2 by 1",
            xticklabels_at="edge bottom",
            yticklabels_at="edge left"
        },
        no_markers
    },
    {},
    PlotInc(Table(x, sin.(x))),
    PlotInc(Table(x, sin.(x .+ 0.5))),
    {},
    PlotInc(Table(x, cos.(x))),
    PlotInc(Table(x, cos.(x .+ 0.5))))

[.pdf], [generated .tex]

Using Axis in group plots

Alternatively, you can use Axis to group together options and a set of plots. This makes it easier to combine existing plots into a grouped plot.

x = range(0; stop =2*pi, length = 100)
axs1 = @pgf Axis({ xlabel = raw"$\alpha$", ylabel = "sin" },
                 PlotInc(Table(x, sin.(x))),
                 PlotInc(Table(x, sin.(x .+ 0.5))));
axs2 = @pgf Axis({ xlabel = raw"$\beta$", ylabel = "cos" },
                  PlotInc(Table(x, cos.(x))),
                  PlotInc(Table(x, cos.(x .+ 0.5))));
@pgf GroupPlot(
    {
        group_style =
        {
            group_size="2 by 1",
            xticklabels_at="edge bottom",
            yticklabels_at="edge left"
        },
        no_markers
    },
    axs1, axs2)

[.pdf], [generated .tex]

Polar axis

angles = [ℯ/50*360*i for i in 1:500]
radius = [1/(sqrt(i)) for i in range(1; stop = 10, length = 500)]
PolarAxis(PlotInc(Coordinates(angles, radius)))

[.pdf], [generated .tex]

Smith Chart

 # Samples for 100 MHz to 10 GHz
frequency = range(100e6,stop=10e9,length=10)
L = 1e-9 # 1 nH
R = 25   # 25 Ω
Z0 = 50  # 50 Ω Reference
# Series network of R + jωL, normalized
network = @. (R + 1.0im*2*pi*frequency*L) / Z0
SmithChart(Plot(Coordinates([(real(z),imag(z)) for z in network])))

[.pdf], [generated .tex]