emilk / emilk/egui_plot

Support for units and SI-prefixes

Open
#55 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
468
Forks
108
Avg merge
15m
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.