-
Notifications
You must be signed in to change notification settings - Fork 301
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
Feature / rescale ticks and units in plot_by_id #1239
Feature / rescale ticks and units in plot_by_id #1239
Conversation
qcodes/dataset/plotting.py
Outdated
unit = data_dict['unit'] | ||
|
||
if unit in _SI_UNITS: | ||
maxval = np.nanmax(data_dict['data']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be the max of the absolute value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it should. but the original implementation did not have it :) I'll change it and add a test for it.
Codecov Report
@@ Coverage Diff @@
## master #1239 +/- ##
==========================================
- Coverage 80.15% 79.18% -0.97%
==========================================
Files 51 52 +1
Lines 7053 7201 +148
==========================================
+ Hits 5653 5702 +49
- Misses 1400 1499 +99 |
This allows other functions to generate a label for a data dict without knowing about the logic that if 'label' field is empty, the 'name' field is used instead.
@QCoDeS/core and @ThorvaldLarsen: should the rescaling of units and ticks be enabled by default or not? |
@QCoDeS/core and @ThorvaldLarsen Another question: should seconds be rescaled? :) |
Definitely. We rarely have ks but use ns or us (microsecond) all the time. Thanks! |
@QCoDeS/core ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that type hints should be added to all the functions introduced here.
@WilliamHPNielsen added type annotations. ready for merge now? |
Request along with #1200. This brings the "rescale_axis" feature of plotting functionality of the old dataset to the
plot_by_id
of the new dataset. The feature scale the ticks and the units (on the axes labels) to engineering units (k
,M
,m
,n
, etc.) so that the plots are more readable. For example,2.000.000.000
inV
becomes2
inGV
if all the numbers on this axis are not larger than 1.000.000.000.000 volts. The feature can be turned of by using a corresponding kwarg.ToDo: