mph- / lcapy

Lcapy is a Python package for symbolic linear circuit analysis and signal processing. It uses SymPy for symbolic mathematics.
GNU Lesser General Public License v2.1
244 stars 46 forks source link

Labels are gone when drawing the same circuit again #106

Open Baby1991 opened 1 year ago

Baby1991 commented 1 year ago

When redrawing the same circuit with a draw command, the labels disappear.

Code to reproduce:

import lcapy

cct = lcapy.Circuit("""
                Vin 1 0_1 DC Vin; down
                SW 1 2; right, l = {dT_s}
                 """)

cct.draw()
cct.draw()

Output: image

mph- commented 1 year ago

Well that's weird since it does not happen for me. Can you please send the outputs for

cct.draw('1.tex')
cct.draw('2.tex')
Baby1991 commented 1 year ago

Of course

1.tex

\documentclass[a4paper]{standalone}
\usepackage{amsmath}
\usepackage{circuitikz}
\usetikzlibrary{fit, shapes, arrows, patterns, decorations.text, decorations.markings}

\begin{document}
\begin{tikzpicture}[scale=1.00, transform shape, /tikz/circuitikz/bipoles/length=1.50cm, american currents, american voltages, voltage dir=RP]
  \coordinate (1) at (0,2);
  \coordinate (0_1) at (0,0);
  \coordinate (2) at (2,2);
  \draw (0_1) to [V, l^=$V_{\mathrm{in}}$, n=Vin] (1);
  \draw (1) to [closing switch, l_={${dT_s}$}, n=SW] (2);
  \draw (1) node[circ] {};
  \draw (0_1) node[ocirc] {};
  \draw (2) node[ocirc] {};
  \draw[anchor=south east] (1) node {1};
  \draw[anchor=south east] (2) node {2};
\end{tikzpicture}
\end{document}

2.tex

\documentclass[a4paper]{standalone}
\usepackage{amsmath}
\usepackage{circuitikz}
\usetikzlibrary{fit, shapes, arrows, patterns, decorations.text, decorations.markings}

\begin{document}
\begin{tikzpicture}[scale=1.00, transform shape, /tikz/circuitikz/bipoles/length=1.50cm, american currents, american voltages, voltage dir=RP]
  \coordinate (1) at (0,2);
  \coordinate (0_1) at (0,0);
  \coordinate (2) at (2,2);
  \draw (0_1) to [V, l^=$V_{\mathrm{in}}$, n=Vin] (1);
  \draw (1) to [closing switch, l_={t{=}0}, n=SW] (2);
\end{tikzpicture}
\end{document}

Also if its needed, lcapy version is 1.13.2