schemedraw graph customize for png output file

Question:

I would like to customize the graph:

  1. How can I increase the output png resolution?
  2. How to change the border color only? I do not want to change label color.
  3. How to adjust box width automatically? box E’s text output the border now.

import schemdraw
from schemdraw import flow

def main(pngname):
    schemdraw.theme('dark')
    d = schemdraw.Drawing()    
    d += flow.Start().color('red').label('AAA')
    d += flow.Arrow().down(d.unit/2)
    d += flow.Box(h=1).label('BBB')    
    d += flow.Arrow().down(d.unit/2)
    d += (A := flow.Box(h=1,fill='#acacac').label('CCC'))    
    d += flow.Arrow().right(d.unit/2).at(A.E)
    d += flow.Box(h=1).label('DDDD')    
    d += flow.Arrow().right(d.unit/2)
    d += flow.Box(w=4,h=1).label('EEEEEEEEEEEEEEEEE')    
    d += flow.Arrow().right(d.unit/2)
    d += flow.Box(h=1).label('F')    

    d.draw()
    d.save(pngname)
    return

pngname = 'demo.png'
main(pngname)

Output:

enter image description here

Asked By: lucky1928

||

Answers:

Output resolution:

d.save(fname=pngname, dpi=some_num)

Change label color only:
This isn’t possible at the moment.

Box width automatically:
Set box width to be a multiple of label length len(your_label)*some_value

Docs:
https://schemdraw.readthedocs.io/en/latest/classes/drawing.html

Answered By: Tanner
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.