-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add optional line to Points PlotItem #4143
Conversation
crates/egui_plot/src/items/mod.rs
Outdated
.for_each(|center| { | ||
let tf = |dx: f32, dy: f32| -> Pos2 { center + radius * vec2(dx, dy) }; | ||
.map(|v| transform.position_from_point(v)) | ||
.collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is paying the price of the collect
wether or not we have a line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds a "line" feature to egui_plot::Points
.
We could instead add a marker
feature to egui_plot::Line
But better yet would probably be to combine Points
and Line
into one thing, instead of replicating features between them. What do you think?
Well yes, I agree completely. In the analogy with other plotting tools like Matplotlib, both kinds of plots are just obtained with |
This will hopefully speed up its development by having more reviewers and maintainers. Please re-open this PR at https://github.com/emilk/egui_plot/pulls See also: |
This is a proposal to add the option to connect the points in the Points PlotItem, similar to "o-" in Matlab or Python Matplotlib.
I don't know if such addition would be welcome in egui_plot, but I needed this in a project, and initially thought about defining a custom PlotItem. But it is not straightforward to implement custom PlotItem, as some methods are private, so it was simpler to just add the options I needed in the existing Points struct. Besides, other people may want to do this.
It is not the same thing as adding two PlotItem: a Line and a Points, because then clicking on the name in the legend would mask only the Points. There are surely workarounds, but I found simpler to just have the option the connect the points in the Points PlotItem.