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

[egui_plot] linked axes wrong scale/bounds #14

Open
jordens opened this issue Oct 16, 2023 · 4 comments
Open

[egui_plot] linked axes wrong scale/bounds #14

jordens opened this issue Oct 16, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@jordens
Copy link

jordens commented Oct 16, 2023

Describe the bug

Linked axes are inaccurately linked.
Compare the y axis of the top left and right plots in the screenshot.

There are a couple more fragility issues with axes linking but this appears to be a dominant one.

To Reproduce
Steps to reproduce the behavior:

  1. https://www.egui.rs/#Demo
  2. Select "Plot" from Egui demos
  3. Select "Linked Axes" tab
  4. Observe incorrect y axis scaling between top left and right plots (range in top left plot is larger)

Expected behavior
Correctly scaled and linked axis.

Screenshots
image

Desktop (please complete the following information):

  • OS: Ubuntu
  • Browser chrome
  • Version 118.0.5993.70

Additional context
egui 0.23
egui_plot 0.23 (also still occurs in current master as of fd75adb)

@jordens jordens added the bug Something isn't working label Oct 16, 2023
@emilk emilk transferred this issue from emilk/egui Jul 15, 2024
@bircni
Copy link
Contributor

bircni commented Aug 4, 2024

Seems like it's not happening in egui 0.28 anymore
image

@jordens

@jordens
Copy link
Author

jordens commented Aug 4, 2024

It is:

354903699-09371375-4d97-4444-8f73-f829d35728a7~2

@bircni
Copy link
Contributor

bircni commented Aug 5, 2024

@YgorSouza what do you think?

@YgorSouza
Copy link
Contributor

It's still the same as when the issue was opened. I don't think anyone has worked on that. I noticed that this change makes the axes match perfectly:

M demo/src/plot_demo.rs
@@ -652,7 +652,7 @@ impl LinkedAxesDemo {
                 .link_cursor(link_group_id, self.link_cursor_x, self.link_cursor_y)
                 .show(ui, Self::configure_plot);
             Plot::new("right-top")
-                .data_aspect(2.0)
+                .data_aspect(1.9)
                 .width(150.0)
                 .height(250.0)
                 .y_axis_label("y")

But I don't know why. Clearly the linked axes don't deal with aspect ratio differences well, but even if we make both plots the same height and width, we have to set the aspect ratio on the second one to 1.05 instead of 1.0 for them to match. Not sure where that is coming from. Removing the data_aspect from both plots also works, so that's probably the place to look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants