-
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
2D plotting functionality #155
Comments
Very cool and impressive! I have a vague plan of adding an immediate mode plot library to egui. My initial inclination is to make something very simple: plotting colored lines without any mouse interaction except hover. I think a more fully-featured plotting library like you are demoing would make sense as a separate crate ( Let me know how One thing I've been planning to add is a transform to |
You're right that this should better be a separate crate since creating/maintaining it would be quite an endeavor. I don't yet know how far I'm going to take this but so far working with egui has been great. As for missing features, the biggest ones are related to text rendering. I haven't been able to find a way to rotate text (note the missing y-axis label) and text positioning in the plot seems to be quite tricky as well but I probably didn't try hard enough there. The transformation function you mention would indeed be helpful, especially with axis mirroring. I am currently doing this in my own function. But I'm afraid linear transformations won't be enough for things like plots with log-log scaling anyways, and there might not be a case to add those to egui itself. |
There is no way to rotate text at the moment. I think adding As for positioning text: use |
One missing feature that I came across in ImPlot, which targets Dear Imgui, is plotting dashed lines and curves. Doing this by drawing a bunch of tiny line segments can become a performance issue. Dear Imgui itself does not provide a way to draw dashed line segments, polylines or curves, so this could be something for you to consider. |
Closed by a19140e |
I have implemented something that is somewhat tangential to plotting, a "Canvas" struct that supports rulers, panning and scaling. Hence the following question: would it be possible to add an optional 2D transformation matrix to the Painter struct? Combined with the already existing and excellent clipping support, this would make rendering in "content" spaces a breeze. |
Having a 2D plotting library inside egui would be highly beneficial. It already has most of the capabilities necessary for implementing one. Taking some inspiration from implot for imgui, I put together a prototype of what this feature may look like.
Note that I only have a surface-level understanding of egui, so much of what I do here may not be "best practice" and there may be better ways to do things. I am willing to continue work on this, but would appreciate occasional reviews, advice or even collaboration from someone who is more proficient with the internal workings of egui. So let me know if you want to help.
https://github.com/EmbersArc/eplot
The text was updated successfully, but these errors were encountered: