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

Fix logarithmic units #4707

Merged
merged 1 commit into from
Apr 4, 2023
Merged

Conversation

gustaphe
Copy link
Collaborator

Description

Closes #4700

Partially based off of work by @ykonter (who is not in zenodo, as far as I can tell). Creates underscored extensions of Unitful's unit and ustrip to deal with logarithmic units.

This is not perfect, note how the y axis in the example doesn't rescale on the plot! call. But there is more than one interpretation of what that call should do anyway, so perhaps good enough should be left good enough here.

Example

julia> plot((1:10)u"dBm", (1:10)u"dB"; seriestype=:scatter)

julia> plot!((1:10)u"mW", (1:10); seriestype=:scatter)

logunits

Attribution

@codecov
Copy link

codecov bot commented Mar 26, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.40 🎉

Comparison is base (4400dba) 89.99% compared to head (988213f) 90.40%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4707      +/-   ##
==========================================
+ Coverage   89.99%   90.40%   +0.40%     
==========================================
  Files          40       40              
  Lines        8359     8725     +366     
==========================================
+ Hits         7523     7888     +365     
- Misses        836      837       +1     

see 33 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@t-bltg t-bltg added bug UnitfulExt recipes for Unitful quantities labels Mar 26, 2023
Copy link
Member

@t-bltg t-bltg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xref jw3126/UnitfulRecipes.jl#72 and jw3126/UnitfulRecipes.jl#73 (to my current knowledge).
I think a partial fix is better than nothing.

@gustaphe
Copy link
Collaborator Author

No documentation changes. The only thing I think is not in line with previous documentation is the conversion weirdness around dimensionless units vs logarithmic ones, and I'm not sure Plots.jl is the place you should be reading about that.

@BeastyBlacksmith BeastyBlacksmith merged commit 082b3bf into JuliaPlots:master Apr 4, 2023
@gustaphe gustaphe deleted the logunits branch April 5, 2023 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug UnitfulExt recipes for Unitful quantities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UnitfulExt not working for logarithmic units
3 participants