# \[ANN\] SmithChart.jl: Visualize Smith charts with Makie.jl

**URL:** <https://discourse.julialang.org/t/ann-smithchart-jl-visualize-smith-charts-with-makie-jl/127391>\
**Category:** Package Announcements\
**Tags:** visualization, engineering\
**Created:** [March 26, 2025, 8:33pm UTC](https://discourse.julialang.org/t/ann-smithchart-jl-visualize-smith-charts-with-makie-jl/127391 "2025-03-26T20:33:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uve](https://avatars.discourse-cdn.com/v4/letter/u/82dd89/32.png) [@Uve](https://discourse.julialang.org/u/Uve)\
**Post date:** [March 26, 2025, 8:33pm UTC](https://discourse.julialang.org/t/ann-smithchart-jl-visualize-smith-charts-with-makie-jl/127391/1 "2025-03-26T20:33:11Z")

</div>

> **[GitHub - uvegege/SmithChart.jl](https://github.com/uvegege/SmithChart.jl)**
>
> Contribute to uvegege/SmithChart.jl development by creating an account on GitHub.

Hello, I’m excited to announce the release of **SmithChart.jl** , a new package that brings interactive Smith charts to the Makie.jl ecosystem. This project was developed as a way to learn and explore the powerful capabilities of Makie.jl, so it may have many aspects to improve. As this is my first Julia (and no Julia) package, I welcome all feedback and suggestions!

### **What is a Smith Chart?**

For those unfamiliar, the Smith chart is a tool for visualizing impedance, admitance, reflection coefficients and more in RF engineering. It’s widely used for designing matching networks, transmission lines, and other RF components. You can learn more about it [here (Wikipedia)](https://en.wikipedia.org/wiki/Smith_chart).

### **What SmithChart.jl Offers**

- **Interactive Smith Charts:** Built on Makie.jl, SmithChart.jl allows for visualization and exploration of impedance and reflection data.
- **`SmithAxis` Block:** Provides a dedicated `SmithAxis` block, similar to `Axis` or `PolarAxis`, for drawing the Smith chart grid.
- **`smithplot!` and `smithscatter!` Functions:** These functions are used to plot data on the Smith chart and have the same attributes as Makie’s `lines!` and `scatter!` respectively. They also include a convenient `reflection` keyword, allowing you to plot reflection data directly without manual conversion. Both functions feature a customised DataInspector (see examples below).
- **`vswr!` Function:** plot constant VSWR circles on the Smith chart using `vswr!`.
- **Normalized Data:** Currently, the package assumes that impedance or admittance values are already normalized.
- **Interactive Data Markers:** Add and remove data markers with a double-click directly on the plots using the `datamarkers` function.
- **Customizable Grid:** Offers extensive customization options for the Smith chart grid, including:
  - Tick positions for constant resistance and reactance circles.
  - Color and linestyle control for the grid lines.
  - Line cutting at intersections to prevent visual clutter.

- **Dynamic Text Annotations** : An optional feature allows tick annotations to move dynamically while zooming to keep them visible. This functionality is still under development and may need further refinement.

### **Examples**

`smithplot!` behaves like `lines!` for styling. This example shows how the `color` attribute can be used to create a color gradient along the line. The DataInspector displays the value and frequency if specified.

```julia
using SmithChart
using GLMakie # Select Backend 
fig = Figure()
ax = SmithAxis(fig[1, 1]; cutgrid = true, subgrid = true, title = "Variable Length Lossy Transmission Line")
# Lossy transmission line
Zo = 50
Zl = 100 + 50im
f = 3.0e9
λ = 3.0e8/f
σ = 6.5
β = 2*pi/λ
s = σ + β*im
l = range(0,λ,101)
# Normalized Impedance
z = [(Zl+(Zo*tanh(s*li)))/(Zo+(Zl*tanh(s*li))) for li in l]
# Draw lines on the Smith Chart
smithplot!(ax, z, reflection = false, color = 1:101, freq = 3.0e9 * ones(length(z)))
# Scatter points on the origin and end points
smithscatter!(ax, [z[1]], markersize = 12.0)
smithscatter!(ax, [z[end]], markersize = 12.0, marker = :cross)
# Colorbar representing the length of the line
Colorbar(fig[1,2], limits = (l[1]/λ, l[end]/λ), ticks = ([0.0, 0.5, 1.0], ["0.0", "λ/2", "λ"]))
# Activate Data Inspector
DataInspector(fig)
fig

```

 ![smithplot_color](https://global.discourse-cdn.com/julialang/original/3X/2/e/2e3992683bd7aa511bb8acda4b2dfca140aab7cb.png)

Easy integration of the Smith chart with Makie.jl’s interactive functionalities

```julia
fig = Figure()
ax = SmithAxis(fig[1, 1], title = "Stub Matching")

Zl = 50.0
Ri = 50.0
Xi = 100.0
zi = Ri + Xi*im
zi = zi / Zl

function simline(z, l)
    bl = 2 * pi * l # Electrical length
    return (z + im * tan(bl)) / (1 + im * z * tan(bl))
end

function simstub(z, l)
    bl = 2 * pi * l
    y_stub = im * tan(-bl)
    return 1 / ((1 / z) + y_stub) 
end

N = 101
sg = SliderGrid(
    fig[2, 1],
    (label = "Line", range = range(0.0, 0.5, 151), format = "{:.3f}λ", startvalue = 0.0),
    (label = "Stub", range = range(0.0, 0.5, 151), format = "{:.3f}λ", startvalue = 0.0))

sliderobservables = [s.value for s in sg.sliders]
z = lift(sliderobservables...) do slvalues...
    line_index, stub_index = [slvalues...]
    line_p = range(0.0, line_index, N)
    stub_p = range(0.0, stub_index, N)
    z_line = simline.(zi, line_p)
    z_stub = simstub.(z_line[end], stub_p)
    return [zi; z_line; z_stub]
end

zend = lift(x->x[end], z)
smithscatter!(zi)
smithplot!(z)
smithscatter!(zend)
fig

```

![sliders](https://global.discourse-cdn.com/julialang/original/3X/2/7/27429756bba3475d74050f86afffc4181282abca.gif)

Add data markers using the `datamarkers(sc::SmithAxis, gp::GridPosition)` function. Double-click on lines or scatter plots to place a marker. To remove a marker, double-click on it.

![datamarkers](https://global.discourse-cdn.com/julialang/original/3X/e/8/e80b7a4c63c6c78aa75789b51f7ce371d3892bd7.gif)

For more examples you can visit the github link.

### **Development Notes**

During development, I aimed to make `SmithChart.jl` as customizable as Makie’s built-in axes. However, I couldn’t find clear documentation on best practices for creating custom blocks like `SmithAxis`. If anyone has insights on this, I’d love to hear your thoughts!

Although still a work in progress, I believe the package is at a stage where it can be useful to others. I would greatly appreciate any feedback on its functionality, API design, or visual presentation.

SmithChart.jl is not yet registered in the General registry. For now, you can install it by adding the package repository. I’m working on registering the package, which will make installation easier in the future once I figure out the registration process.

Thanks for your interest!

---

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [March 26, 2025, 11:35pm UTC](https://discourse.julialang.org/t/ann-smithchart-jl-visualize-smith-charts-with-makie-jl/127391/2 "2025-03-26T23:35:33Z")

</div>

The plots and interactivity look terrific! It’s great to see more RF/microwave packages in the Julia ecosystem.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 27, 2025, 10:27am UTC](https://discourse.julialang.org/t/ann-smithchart-jl-visualize-smith-charts-with-makie-jl/127391/3 "2025-03-27T10:27:00Z")

</div>

Very cool, pretty impressive for your first package! You even made a custom block and that’s not documented at all 😄

---

<div class="post-metadata">

**Author:** ![tamasgal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamasgal/32/27946_2.png) [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Post date:** [March 27, 2025, 10:37am UTC](https://discourse.julialang.org/t/ann-smithchart-jl-visualize-smith-charts-with-makie-jl/127391/4 "2025-03-27T10:37:06Z")

</div>

Amazing work! 😃

---

<div class="post-metadata">

**Author:** ![xiaoxi](https://avatars.discourse-cdn.com/v4/letter/x/a9adbd/32.png) [@xiaoxi](https://discourse.julialang.org/u/xiaoxi)\
**Post date:** [March 28, 2025, 6:00am UTC](https://discourse.julialang.org/t/ann-smithchart-jl-visualize-smith-charts-with-makie-jl/127391/5 "2025-03-28T06:00:50Z")

</div>

Very cool and inspiring!

> [@PeterSimon](#):
>
> It’s great to see more RF/microwave packages in the Julia ecosystem.

As there are more and more RF/microwave related packages, I hope that soon there will be a Github Organization that encompasses them all.
