Draw circuit schematic in pure Julia

Hello,

I need to draw some circuit schematic like the following

And then embedding this schematic in my plots made with Makie.jl

The current approaches I have investigated so far are circuitkz and schemdraw. The first is directly embedded in latex, but I find it very difficult but also not so fancy as the image above. The second is a python package, which I’m still exploring now.

However, while I was trying schemdraw, I was thinking if this can be seamlessly done directly in Julia, maybe also directly using Makie.jl functions. But I don’t know if the amount of work to do worth it.

2 Likes

In other words, how would you suggest to structure this possible package?

Should I define specific structs for Resistor, Capacitor, etc…, like in schemdraw? What should they contain? Like the poly object and what else?

Moreover, how should I manage the package dependencies? Should all CairoMakie.jl, GLMakie.jl, WGLMakie.jl be direct dependencies of the package? This would make it very heavy I think.

Finally, should I use Makie.jl’s recipes?

You could perhaps take a look at this one, which is somewhat similar:

Likely will have some overlap with:

1 Like

Wow, this package seems very advanced. But it seems more in the design rather than generic schematic like the figure I have attached. In other words, can this package reproduce an image similar to that?

Thank you for citing this package. I think however that the style is different from the image I have attached before.

You’re right that DeviceLayout.jl is oriented more towards physical layout/design than circuit schematic drawings. You could use it to draw a schematic like this by defining components like Resistor, composite components combining them in parallel, and so on, but I wouldn’t really recommend it. (I actually prototyped a kit for drawings like this with DeviceLayout.jl but ultimately preferred circuitikz for this use case. You can definitely draw your example in circuitikz, but it’s true that there’s a learning curve.) It’s not graphics-oriented, so for example the color fill on the transmission line would be especially tedious to define. To me the major limitation is that we don’t have support for nice TeX labels like in your example. (Although maybe if we had a Makie backend…)