Lessons / Part 9. Figures, drawings and deliverables made from code
61 Make figures from code, not from generated pictures
A script that draws the figure, so each later change is one named line and the export comes out the same every time.
What people usually ask
Generate an image of a process schematic for my slides. It is a spray dryer with a cyclone and a bag filter.
What comes back
A picture with roughly the right shapes and misspelled labels that cannot be edited, and the next round gives a new picture with the shapes moved.
Ask this instead
Draw the schematic of my spray dryer line as a matplotlib script, not as an image. Elements left to right: feed tank, pump, atomizer at the top of the drying chamber, cyclone, bag filter, exhaust fan. Use the labels in the attached list exactly, and put nothing else on the page.
One idea per page. This page shows the path of the solids only; the air path is a second script later.
Make every piece of text twice the size you would first choose. The slide is read from the back of a room; nothing under 18 pt.
Save the script as fig_dryer_solids.py. Export fig_dryer_solids.pdf and fig_dryer_solids.png with savefig at dpi=300.
Give each element a variable name in the script (feed_tank, cyclone, bag_filter) so I can ask for changes by name. Show me the PNG and stop.
Attach: A photo of the hand sketch and the list of labels as plain text.
Why it works: The figure lives as code, so the next correction is one named line and the export is identical each time it runs.
Drafted with Fable 5.1 from my notes; chosen and edited by me.