cdelker / schemdraw

MIT License
103 stars 20 forks source link

Example produces empty image #38

Closed kassi closed 3 months ago

kassi commented 3 months ago

When I use the example in the docs or readme, e.g.

import schemdraw
import schemdraw.elements as elm

with schemdraw.Drawing():
    elm.Resistor().label('100KΩ')
    elm.Capacitor().down().label('0.1μF', loc='bottom')
    elm.Line().left()
    elm.Ground()
    elm.SourceV().up().label('10V')

I'm getting an empty image. Even when specifying a file, the resulting svg is empty. This happens as a standalone python script (3.12.3) or inside a notebook (conda installation).

I figured out that I have to write:

import schemdraw
import schemdraw.elements as elm

with schemdraw.Drawing() as d:
    d += elm.Resistor().label('100KΩ')
    d += elm.Capacitor().down().label('0.1μF', loc='bottom')
    d += elm.Line().left()
    d += elm.Ground()
    d += elm.SourceV().up().label('10V')

in order to make it work.

kassi commented 3 months ago

Oh damn. Figured out that conda installed an old version (0.15) and after installing 0.19 notebook wasn't reloaded properly.