SmithAxis Block
The SmithAxis is a layoutable visual block built on top of Makie.jl using the @Block macro. It provides an intuitive and familiar interface for plotting complex reflection and impedance data on a Smith chart.
It behaves like any other axis block (such as Axis, PolarAxis, or LScene) in Makie. You can place it inside a GridLayout, style it, and compose it freely with other visual components.
Usage
To use a SmithAxis, simply add it in a figure layout:
using SmithChart
using CairoMakie
fig = Figure()
sc = SmithAxis(fig[1, 1]; cutgrid = true, type = :Z)
fig
This creates a Smith chart axis. You can then use functions like smithplot! or smithscatter! to draw data onto it.
Keyword Options
You can explore all keyword arguments by calling:
?SmithAxisHere are some of the most commonly used:
| Keyword | Description | Default |
|---|---|---|
cutgrid | Whether to cut the Smith grid at ±90° for a clearer display | false |
type | The Smith chart type: :Z (impedance) or :Y (admittance) | :Z |
tickalign | Alignment of tick marks | (:center, :center) |
tickbox | Show bounding boxes behind tick labels | true |
zoomupdate | Dynamically adjust grid resolution based on zoom level | false |
textupdate | Enables dynamic hover annotations on plotted data (experimental) | false |
spinewidth | Linewidth of the exterior circumference. | 2.2 |
spinehorizontalwidth | Linewidth of the spine horizontal line . | 1.7 |
Full List of SmithAxis fields and keywords
Below is a comprehensive list of the fields and keywords available for the SmithAxis block. Note that some fields are intentionally omitted because they are not intended for direct user manipulation and are used internally to control specific implementation details.
Also, some keywords related to the scene or internal aspects of Makie may have no visible effect. These were included preventively during the development of the block in case they might be needed later, even if they are not currently used.
Contents
- Smith Chart Settings
- Scene Settings
- Background and Clipping
- Limits and Transformations
- Title and Subtitle
- Spine Settings
- Grid Settings
- Tick Settings
Smith Chart Settings
type::Symbol = :ZSmith Chart type. Valid values are:Z,:Y, and:ZY.cutgrid::Bool = trueControls the cut of the lines.cutgridalg::Int = 2Select cutgrid algorithm (1 or 2).subgrid::Bool = falseControls if there is a subgrid drawn in the image.zoomupdate::Bool = falseControls the interactivesubgridupdate while zooming.textupdate::Bool = falseControls if there are interactive text annotations while moving and zooming.ntextvals::Int = 7Controls the maximum number of text labels.threshold = (100, 100)Threshold controling the cut of the grid
Scene Settings
height = nothingThe height setting of the scene.width = nothingThe width setting of the scene.tellwidth::Bool = trueControls if the parent layout can adjust to this element's width.tellheight::Bool = trueControls if the parent layout can adjust to this element's height.halign = :centerThe horizontal alignment of the scene in its suggested bounding box.valign = :centerThe vertical alignment of the scene in its suggested bounding box.alignmode = Inside()The alignment mode of the scene in its suggested bounding box.xreversed::Bool = falseControls if the x axis goes rightwards (false) or leftwards (true) in default camera orientation.yreversed::Bool = falseControls if the y axis goes leftwards (false) or rightwards (true) in default camera orientation.
Background and Clipping
sample_density::Int = 361The density at which curved lines are sampled (grid lines, spine lines, clip).backgroundcolorThe background color of the axis.backgroundcolorintThe internal background color of the axis.clip::Bool = trueControls whether to activate the nonlinear clip feature.clipcolorSets the color of the clip polygon (mainly for debugging).innerclipz::Float32 = -100.0Sets the z value of inner clip.outerclipz::Float32 = 100.0Sets the z value of outer clip.
Limits and Transformations
limits = ((-1., 1.), (-1., 1.))Define axis limits.aspect::Float32 = 1.0Controls the forced aspect ratio of the Smith Chart.vlimit::Float32 = 1.0Radial limit of the Smith Chart.xautolimitmargin::Tuple{Float64, Float64} = (0.05, 0.05)Relative margins added to the autolimits in x direction.yautolimitmargin::Tuple{Float64, Float64} = (0.05, 0.05)Relative margins added to the autolimits in y direction.
Title and Subtitle
title = ""The title of the plot.titlegap::Float32 = 4.0The gap between the title and the top of the axis.titlealign = :centerThe alignment of the title (:center,:left, or:right).titlesize::Float32 = 16.0The fontsize of the title.titlefont = :boldThe font of the title.titlecolor = :blackThe color of the title.titlevisible::Bool = trueControls if the title is visible.subtitle = ""The content of the axis subtitle.subtitlefont = :regularThe font family of the subtitle.subtitlesize::Float64 = 16.0The subtitle's font size.subtitlegap::Float64 = 0The gap between subtitle and title.subtitlevisible::Bool = trueControls if the subtitle is visible.subtitlecolor::RGBAf = :blackThe color of the subtitle.subtitlelineheight::Float64 = 1The axis subtitle line height multiplier.
Spine Settings
spinez::Float32 = 9000Sets the z value of the exterior circumference. To place the grid above plots set a value > 1.spinecolor = :blackColor of the exterior circumference.spinewidth::Float32 = 2.2Linewidth of the exterior circumference.spinehorizontalwidth::Float32 = 1.7Linewidth of the horizontal line.spinestyleLinestyle of the exterior circumference.spinevisible::Bool = trueControls if the exterior circumference is visible.
Grid Settings
General Grid
gridcolor = nothingControls the color of ALL the grid. This has preference over other color keywords.zgridcolor = nothingControls the color of Z smith chart grid. This has preference overrgridcolorandxgridcolorwhen is not equal tonothing.ygridcolor = nothingControls the color of Y smith chart grid. This has preference overbgridcolorandggridcolorwhen is not equal tonothing.splitgrid = (1, 1, 3)Controls the number of times the grid is split for each zoom level.
Resistance Grid
rvals::Vector{Float64} = [0.2, 0.4, 0.6, 1.0, 2.0, 5.0, 20.0]Resistance grid positions.rgridz::Float32 = -50Sets the z value of the Resistance arcs grid.rgridcolor = :blackColor of the Resistance grid.rgridwidth::Float32 = 0.7Linewidth of the Resistance grid.rgridstyleLinestyle of the Resistance grid.rgridvisible::Bool = trueControls if the Resistance grid is visible.rsubgridstyle = :dashResistance subgrid style.rsubgridwidth::Float32 = 0.7Linewidth of the Resistance subgrid.rsubgridcolor = :blackColor of the Resistance subgrid.
Reactance Grid
xvals::Vector{Float64} = [0.2, 0.4, 0.6, 1.0, 2.0, 5.0, 20.0]Reactance grid positions.xgridz::Float32 = -50Sets the z value of the Reactance arcs grid.xgridcolor = :blackColor of the Reactance grid.xgridwidth::Float32 = 0.7Linewidth of the Reactance grid.xgridstyleLinestyle of the Reactance grid.xgridvisible::Bool = trueControls if the Reactance grid is visible.xsubgridstyle = :dashReactance subgrid style.xsubgridwidth::Float32 = 0.7Linewidth of the Reactance subgrid.xsubgridcolor = :blackColor of the Reactance subgrid.
Conductance Grid
gvals::Vector{Float64} = [0.2, 0.4, 0.6, 1.0, 2.0, 5.0, 20.0]Conductance grid positions.ggridz::Float32 = -50Sets the z value of the Conductance arcs grid.ggridcolor = :blackColor of the Conductance grid.ggridwidth::Float32 = 0.7Linewidth of the Conductance grid.ggridstyleLinestyle of the Conductance grid.ggridvisible::Bool = trueControls if the Conductance grid is visible.gsubgridstyle = :dashConductance subgrid style.gsubgridwidth::Float32 = 0.7Linewidth of the Conductance subgrid.gsubgridcolor = :blackColor of the Conductance subgrid.
Susceptance Grid
bvals::Vector{Float64} = [0.2, 0.4, 0.6, 1.0, 2.0, 5.0, 20.0]Susceptance grid positions.bgridz::Float32 = -50Sets the Susceptance value of the arcs grid.bgridcolor = :blackColor of the Susceptance grid.bgridwidth::Float32 = 0.7Linewidth of the Susceptance grid.bgridstyleLinestyle of the Susceptance grid.bgridvisible::Bool = trueControls if the Susceptance grid is visible.bsubgridstyle = :dashSusceptance subgrid style.bsubgridwidth::Float32 = 0.7Linewidth of the Susceptance subgrid.bsubgridcolor = :blackColor of the Susceptance subgrid.
Tick Settings
tickalign = (:center, :center)Align of the R tickstickbox::Bool = trueControls if we draw a box behind the text
Reactance Ticks
xtickvisible::Bool = trueControls if the exterior circunference ticks are visiblextickformat = Makie.automaticThe formatter for the exterior ticks.xticklabelsize::Float32 = inherit(scene, (:Axis, :xticklabelsize), inherit(scene, :fontsize, 16))The fontsize of the exterior tick labels.xticklabelfont = inherit(scene, (:Axis, :yticklabelfont), inherit(scene, :font, Makie.defaultfont()))The font of the exterior tick labels.xticklabelcolor = inherit(scene, (:Axis, :yticklabelcolor), inherit(scene, :textcolor, :black))The color of the exterior tick labels.xticklabelpad::Float32 = 4.5f0Padding of the exterior ticks label.xticklabelstrokewidth::Float32 = 0.0The width of the outline of exterior ticks. Setting this to 0 will remove the outline.xticklabelstrokecolor = automaticThe color of the outline of exterior ticks. By default this uses the background color.
Resistance Ticks
rtickformat = Makie.automaticThe formatter for the r ticksrticklabelsize::Float32 = inherit(scene, (:Axis, :yticklabelsize), inherit(scene, :fontsize, 16))The fontsize of the RESISTANCE tick labels.rticklabelfont = inherit(scene, (:Axis, :xticklabelfont), inherit(scene, :font, Makie.defaultfont()))The font of the r tick labels.rticklabelcolor = inherit(scene, (:Axis, :xticklabelcolor), inherit(scene, :textcolor, :black))The color of the r tick labels.rticklabelstrokewidth::Float32 = 0.0The width of the outline of r ticks. Setting this to 0 will remove the outline.rticklabelstrokecolor = automaticThe color of the outline of r ticks. By default this uses the background color.rticklabelpad::Float32 = 4f0Padding of the r ticks label.rtickvisible::Bool = inherit(scene, (:Axis, :xticklabelsvisible), true)Controls if the r ticks are visible.rtickangle::Float32 = 0.0The angle in radians along which the r ticks are printed.
Susceptance Ticks
btickvisible::Bool = trueControls if the exterior circunference ticks are visiblebtickformat = Makie.automaticThe formatter for the exterior ticks.bticklabelsize::Float32 = inherit(scene, (:Axis, :xticklabelsize), inherit(scene, :fontsize, 16))The fontsize of the exterior tick labels.bticklabelfont = inherit(scene, (:Axis, :yticklabelfont), inherit(scene, :font, Makie.defaultfont()))The font of the exterior tick labels.bticklabelcolor = inherit(scene, (:Axis, :yticklabelcolor), inherit(scene, :textcolor, :black))The color of the exterior tick labels.bticklabelpad::Float32 = 4f0Padding of the exterior ticks label.bticklabelstrokewidth::Float32 = 0.0The width of the outline of exterior ticks. Setting this to 0 will remove the outline.bticklabelstrokecolor = automaticThe color of the outline of exterior ticks. By default this uses the background color.
Conductance Ticks
gtickformat = Makie.automaticThe formatter for the Conductance ticks.gticklabelsize::Float32 = inherit(scene, (:Axis, :yticklabelsize), inherit(scene, :fontsize, 16))The fontsize of the Conductance btick labels.gticklabelfont = inherit(scene, (:Axis, :xticklabelfont), inherit(scene, :font, Makie.defaultfont()))The font of the Conductance tick labels.gticklabelcolor = inherit(scene, (:Axis, :xticklabelcolor), inherit(scene, :textcolor, :black))The color of the Conductance tick labels.gticklabelstrokewidth::Float32 = 0.0The width of the outline of Conductance ticks. Setting this to 0 will remove the outline.gticklabelstrokecolor = automaticThe color of the outline of Conductance ticks. By default this uses the background color.gticklabelpad::Float32 = 4f0Padding of the Conductance ticks label.gtickvisible::Bool = trueControls if the Conductance ticks are visible.gtickangle::Float32 = 0.0The angle in radians along which the Conductance ticks are printed.
Example
using SmithChart
using CairoMakie
fig = Figure(size = (800, 600))
sc = SmithAxis(fig[1, 1], cutgrid = true)
r = 0.6 .+ 0.15 * cis.(range(0, 2π; length = 300))
smithplot!(sc, r; color = :dodgerblue, linewidth = 2)
fig