Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storing graphics in dict #65

Closed
wants to merge 1 commit into from
Closed

storing graphics in dict #65

wants to merge 1 commit into from

Conversation

clewis7
Copy link
Member

@clewis7 clewis7 commented Dec 13, 2022

addresses #64

moved to store graphics in dict with keys as the graphic class

keys currently need to passed in as a string, need to work on implementation to allow for

gp[0,0].get_graphics()[ImageGraphic]

as opposed to

gp[0,0].get_graphics()["ImageGraphic"]

@clewis7
Copy link
Member Author

clewis7 commented Dec 13, 2022

right now, I have it creating the keys to the dict by

self._graphics[graphic.__class__.__name__] = list()
self._graphics[graphic.__class__.__name__].append(graphic)

but __name__ returns a string, any suggestions on how to get graphic class name not as a string when just __class__ gives fastplotlib.graphics.image.ImageGraphic

@kushalkolar
Copy link
Member

yea not sure whether the best approach is to have it as a str or the class type itself, I think using graphic.__class__ should work, you can check if:

graphic.__class__ is ImageGraphic

@kushalkolar
Copy link
Member

after this is done modify the __repr__ for PlotArea such that if there are > 5 graphics of any type, show only the first 5 and last 5 because I know there will be someone at the workshop who crashes their jupyter because they ended up calling the repr while having 10,000 graphics in a gridplot 🙃

@kushalkolar
Copy link
Member

after #88 there is now a class attribute that stores the name of the graphic as a str in lower case, see: https://github.com/kushalkolar/fastplotlib/pull/88/files#diff-a57994ecff1cde4e05c8175265219f0b5200da144ce8733b9eb560c09bcea7ddR9

@kushalkolar
Copy link
Member

rebase on mater or just start a new PR, this is pretty straight forward.

@kushalkolar
Copy link
Member

I think that since PlotAreas are indexable we don't really need this. We can revisit if it becomes necessary in the future.

@kushalkolar kushalkolar closed this Jan 9, 2023
@kushalkolar kushalkolar deleted the graphic-org branch April 17, 2023 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants