GeezerVison is showing github.com — better organization of Graphics · Issue #64 · fastplotlib/fastplotlib
better organization of Graphics #64
Description
- We will soon have
LineCollection so we should probably add a class attribute to each Graphic subclass which is used by Plot when attaching all the graphic names as methods, since we'd want plot.line_collection() rather than plot.linecollection() and it maintains pep8 standards
- It would be useful for
Subplot.get_graphics() to return a dict instead of a list, where the keys are the object class.
example:
from fastlotlib.graphics import ImageGraphic
graphics_in_subplot = gp[0, 0].get_graphics()
graphics_in_subplot[ImageGraphic] # list of all `ImageGraphic` graphic instances within the subplot
@clewis7 thoughts?
Activity
clewis7 commented on Dec 13, 2022
I like this idea! I can work on making Subplot.get_graphics() return a dict instead of a list
kushalkolar commented on Dec 17, 2022
I think it'd be useful to use the __init_subclass__ to parse Graphic class names automatically and set it as a class attribute that can be used for this purpose, but also for attaching the various add_graphic-name methods, so we can have this parsing code in just one place.
This would also make it so that the dict keys for this PR are str, I think str is better since then the user doesn't need another set of import statements for graphic objects.
kushalkolar commented on Jan 2, 2023
printing it out like a table or just with nice tabspacing would be nice:
images:
"image-name-a" <mem location etc...>
line_collection:
"lc-A" <n-items>, ...
Metadata
Metadata
Development
No branches or pull requestsIssue actions