glotzerlab / plato

Efficient visualization of particle data supporting several rendering engines.
https://plato-draw.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
12 stars 4 forks source link

Add imperative API #48

Closed klarh closed 4 years ago

klarh commented 5 years ago

This proposed API makes quick visualizations more streamlined by automatically keeping track of primitive objects and displaying them. It can be used automatically (much like matplotlib figures get automatically displayed for each jupyter cell) in jupyter notebooks, or more manually controlled by imp.show(). I'm interested in hearing whether other users are interested in this API!

bdice commented 5 years ago

As with matplotlib’s pyplot.gcf(), I think a public method for getting a scene via the imperative API would be useful. A related challenge that I face a lot: I wish it was easier to fetch a specific primitive from a scene and adjust its attributes (specifically colors). E.g. I make a scene of some spheres and a box, and I want to color the spheres according to different analysis methods. Implementing __getitem__ on the scene object would be one method of doing this. With the PR I made for garnett, this would be especially helpful: https://github.com/glotzerlab/garnett/pull/120