-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Plot auto-fit broken since 0.17.x #1649
Comments
i'll check this. Looks like I broke it. |
Just checked. Not me. Could you create example on 0.17? It always have been prioritizing X axis - https://github.com/emilk/egui/blob/master/egui/src/widgets/plot/mod.rs#L722 You could try to pass |
I believe you want add this lines
here https://github.com/emilk/egui/blob/master/egui/src/widgets/plot/transform.rs#L316 |
Here's the same example for 0.17: And for 0.16: The relevant code is identical in all cases--only the app setup boilerplate is different. EDIT: and just to be clear, 0.16 has the correct expected behavior. The bug was introduced in 0.17. |
I have also noticed the auto fit also does not like lines or points with a constant y value. Here is a demo of this in action: recordedVideo.mp4You can see the auto fit work perfectly fine with the very noisy I have checked and this behavior happens even with The work around to fix this is to just add two I have also seen this occur when the plot only contains one point on the x axis. It looks to be the same issue as with the Y axis |
Any progress on this? It's not super urgent, but it is blocking the next public release of a set of tools I maintain. (I've attempted to hack around this in the client code, and I've successfully made it frame things properly, but it also snaps back to auto-framing whenever the plotted data changes, which makes it essentially impossible for the user to manually re-frame things when the data is continually changing (which is a common situation in these tools).) |
I'll take a look |
Awesome, thanks so much! |
Describe the bug
In egui 0.16.x and earlier, plots would by default auto-fit to ensure that the entire plot was visible, like this:
This would work regardless of the data aspect ratio or the aspect ratio of the containing frame. However, since 0.17.x (up to and including 0.18.0 and current master as of filing this issue), if the plot frame has a wider aspect ratio than the data, the auto-fitting cuts off the top and bottom of the plot like this:
It seems like the code is only fitting for width, but not for height. This erroneous behavior also manifests with the
Plot::include_x()
andPlot::include_y()
methods, making the bug difficult to work around manually in client code.To Reproduce
Desktop:
The text was updated successfully, but these errors were encountered: