-
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
Plotting: Add line markers #362
Comments
Can I ask what this is for? I thought line markers were used mostly when printing plots in black-and-white. Is there really a need for it in a full-color interactive plot? And if there is a need for something like this, isn't dashed and dotted lines more readable? |
Showing the data points as dots makes sense, and supporting scatter plots makes sense as well. It's the choice of using symbols (stars, triangles, …) over colored dots that gets me a bit hesitant. One could argue the the former is better for the color blind, but interactive plots which can highlight on hover makes this much less of a problem already. |
Using symbols on line charts is pretty common in the infoviz world, I think. It's recommended over colored dots precisely because of readability. Uglier for sure, though, which is why it'd be nice to support either method. Maybe if the markers could take on the color of the line? |
Based on experience, I can confirm that it's sometimes very useful to have a small selection of marker shapes to choose from. They may have different meanings in the plot and then it could be confusing to only have dfiferent colored dots. But I understand your concerns @emilk so I took some time to figure out how to keep functionality simple while still making different marker shapes available. Now, you can add a default marker to the plot like this: Curve::from_parametric_callback(
move |t| ((2.0 * t + time).sin(), (3.0 * t).sin()),
0.0..=TAU,
100,
)
.color(Color32::from_rgb(100, 150, 250))
.marker(Marker::default())
.name("x = sin(2t), y = sin(3t)") This will add filled dots to the datapoints with the same color as the line, as suggested by @skairunner as well. But they can be customized further (within reason) like this: curve.marker(marker.filled(false).radius(5.0).color(Color32::GRAY)) I extended the plot demo a bit so that we can showcase this: recording.mp4 |
It would be great to have line markers for curves in the plotting library. It's mostly done but there are still some open questions that I'll have to figure out when it comes to user friendliness. I'll open a draft PR soon.
The text was updated successfully, but these errors were encountered: