Skip to content

show=False does not suppress drawing plots #87

@DanielSank

Description

@DanielSank

This program

import schemdraw
import schemdraw.elements as elm


def capacitor() -> schemdraw.Drawing:
    with schemdraw.Drawing(show=False) as d:
        d += elm.Capacitor()
    return d


def tline() -> schemdraw.Drawing:
    with schemdraw.Drawing(show=False) as d:
        d += elm.Coax()
    return d


def main() -> None:
    with schemdraw.Drawing() as d:
        d += elm.ElementDrawing(capacitor())
        d += elm.ElementDrawing(tline())
    d.draw()


if __name__ == "__main__":
    main()

causes three plots to appear. One plot shows a capacitor, one shows a transmission line, and one shows a capacitor connected to a transmission line. Then, if I close them, a fourth plot appears, again showing a capacitor connected to a transmission line.

I see this as unexpected behavior. I would have thought that, because I have show=False in the sub-drawings, I would see only one plot.

If we change main to be this

def main() -> None:
    d = capacitor()
    d.draw()

then one plot appears, showing a capacitor, and when I close it a second plot appears, also showing a capacitor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions