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

handling colors and other modifiable attributes #77

Closed
kushalkolar opened this issue Dec 18, 2022 · 5 comments
Closed

handling colors and other modifiable attributes #77

kushalkolar opened this issue Dec 18, 2022 · 5 comments

Comments

@kushalkolar
Copy link
Member

kushalkolar commented Dec 18, 2022

The way colors are handled by Graphic is kinda of wonky now, I'm thinking of making a base class GraphicAttribute which is indexable, this would allow intuitive fine grained color control. It would probably also fix the current wonkyness of ScatterGraphic.

example:

plot = Plot()

line_graphic = plot.line(data=<sine_wave>)

line_graphic.colors[50:100] = "red"
line_graphic.colors[100:] = (0, 1, 0, 1)
line_graphic.colors = "w"
...

This would basically call pygfx geometry/material colors.data and the update_range() for only the indices modified

@EricThomson @clewis7 thoughts?

@clewis7 this will get rid of all the current update_<graphic_attr> methods, but we can change that later. For interactivity we can just allow anything that is a GraphicAttribute instance to be a modifiable feature.

@EricThomson
Copy link
Contributor

This seems great I really like it! Would make certain things really intuitive and simple.

@kushalkolar
Copy link
Member Author

Could also add sizes, at least for scatter, might also be possible for line

@kushalkolar
Copy link
Member Author

@clewis7 once #61 is merged we need to think of how to trigger events when a GraphicAttribute changes its data, will have to work for Graphic and GraphicCollection objects.

@kushalkolar
Copy link
Member Author

for now thing left to do is sizes

@kushalkolar
Copy link
Member Author

mostly implemented in #78 and #88, this issue superseeded by #85

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

No branches or pull requests

2 participants