Skip to main content

Posts

Showing posts with the label Schemdraw

Draw a Common Emitter Amplifier with SchemDraw on Python3.7

I tried to draw a common emitter amplifier by using SchemDraw package in Google Colab Notebook. I installed SchemDraw version=0.14 by pip in Colab Notebook. This version is not latest. The latest version(=0.15) probably has some ploblem. pip install schemdraw==0.14 The version of Python in the notebook kernel is 3.7. It came up against a diffculty. In Python 3.7. or earlier the Walrus operator := is not available. import schemdraw print('Schemdraw',schemdraw.__version__) !python --version # Schemdraw 0.14 # Python 3.7.13 Sample codes in the SchemDraw Gallary are written with the Walrus operator. For instance the code below is one in the gallary and dose not work in the Colab Notebook. import schemdraw import schemdraw.elements as elm # Discharging capacitor with schemdraw.Drawing() as d: d += (V1 := elm.SourceV().label('5V')) d += elm.Line().right(d.unit*.75) d += (S1 := elm.SwitchSpdt2(action='close').up().anchor('b').label('$t=0$...

Schemdraw AttributeError: 'Text' object has no property 'math_fontfamily'

When I used Method label of schemdraw.elements.xxxx, I got an error message ERROR: AttributeError: 'Text' object has no property 'math_fontfamily'. This error happened in matplotlib. The property 'math_fontfamily' may be changed to 'mathtext.fontset'. But the ploblem was the version of Schemdraw that is 0.15. pip install schemdraw==0.15 import schemdraw.elements as elm d = schemdraw.Drawing() d += elm.Resistor().label('6.8KΩ') d.draw() # AttributeError: 'Text' object has no property 'math_fontfamily' When I installed version=0.14, no error appeared. pip install schemdraw==0.14 import schemdraw.elements as elm d = schemdraw.Drawing() d += elm.Resistor().label('6.8KΩ') d.draw() With version=0.14, no more error.

Draw high-quality electrical circuit schematic diagrams with Schemdraw in Python

Here I will draw electrical circuit diagrams with Schemdraw in Python. Schemdraw is a Python package for producing high-quality electrical circuit schematic diagrams. Circuit elements are added, one at a time, similar to how you might draw them by hand, using Python methods. Installation Schemdraw can be installed from pip using pip install schemdraw The schemdraw module "schemdraw.elements" is used for drawing circuit elements. It contains Basic Elements pre-defined for use in a drawing. import schemdraw import schemdraw.elements as elm You can create with using a schemdraw.Drawing and add elements using 'add'method or '+=' poperator. with schemdraw.Drawing() as d: d.add(elm.Resistor()) d.add(elm.Capacitor()) d += elm.Diode() Save figure to a file. Using the with block the drawing is displayed and saved as exiting the with block. The filename is assgined by parameter file in schemdraw.Drawing() like file='my_circui...