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

Support for units and SI-prefixes #55

Open
alexforencich opened this issue Oct 23, 2024 · 0 comments
Open

Support for units and SI-prefixes #55

alexforencich opened this issue Oct 23, 2024 · 0 comments

Comments

@alexforencich
Copy link

alexforencich commented Oct 23, 2024

pyqtgraph supports specifying units as part of the axis labels like so:

    self.diff_plot.setLabel('left', "Difference", units='s')
    self.diff_plot.setLabel('bottom', "Time", units='s')

This does several things:

  • The unit is included in the label. In this case, the labels would read "Difference (s)" and "Time (s)")
  • An SI prefix is added and the axis rescaled appropriately. So, if the Y-axis in the example ranged from -10e-9 to 10e-9, the scale value of 1e-9 = n would be used, the axis would be drawn as -10 to 10, and the unit would be displayed as "ns". Naturally the unit would change appropriately as the graph is rescaled.
  • The rescaling removes all leading/trailing zeros, reducing the length of the axis markers, which should also reduce issues with the markers being rendered on top of the axis labels.

It would be very cool to see similar functionality in egui_plot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant