sefffal / PairPlots.jl

Beautiful and flexible vizualizations of high dimensional data
https://sefffal.github.io/PairPlots.jl/dev
MIT License
130 stars 7 forks source link

Add support for units (Unitful and DynamicQuantities) #30

Closed sefffal closed 9 months ago

sefffal commented 9 months ago

This PR address the feature request in #22. We strip off the units for columns and display them as labels (unless user has provided labels, in which case they are ignored).

The units are displayed in dark grey and in brackets. If the user wants a different style, they can as always just pass in the labels themselves.

Supports both Unitful and DynamicQuantities, and even mixtures of both packages on different columns.

using Unitful # or DynamicQuantities
df = DataFrame((;a=randn(10000)*u"m",b=randn(10000)*u"m/s"))
pairplot(df)
image
juliohm commented 9 months ago

Maybe adopt [unit] instead of (unit)? This is the notation that most papers adopt as far as I know.

Em ter., 28 de nov. de 2023 16:19, William Thompson < @.***> escreveu:

This PR address the feature request in #22 https://github.com/sefffal/PairPlots.jl/issues/22. We strip off the units for columns and display them as labels (unless user has provided labels, in which case they are ignored).

The units are displayed in dark grey and in brackets. If the user wants a different style, they can as always just pass in the labels themselves.

Supports both Unitful and DynamicQuantities, and even mixtures of both packages on different columns.

using Unitful # or DynamicQuantities df = DataFrame((;a=randn(10000)u"m",b=randn(10000)u"m/s"))pairplot(df)

image.png (view on web) https://github.com/sefffal/PairPlots.jl/assets/7330605/fc82019f-0a96-43c0-9e64-aeeee3a9f187

You can view, comment on, or merge this pull request online at:

https://github.com/sefffal/PairPlots.jl/pull/30 Commit Summary

File Changes

(4 files https://github.com/sefffal/PairPlots.jl/pull/30/files)

Patch Links:

— Reply to this email directly, view it on GitHub https://github.com/sefffal/PairPlots.jl/pull/30, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZQW3NO6RCU34ZHQJ67RGTYGY2LVAVCNFSM6AAAAAA76ISONCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYTKMJTHA3TEMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sefffal commented 9 months ago

Appreciate the suggestion. Indeed, this NIST style guide recommends square brackets, so sure we can go with these. https://www.nist.gov/pml/special-publication-811/nist-guide-si-chapter-7-rules-and-style-conventions-expressing-values

I do worry that this is field-dependent though (I often see round brackets).

There will no doubt be issues requesting other styles in future (eg. for angular units to have a space, etc.) but I think my position will be not to allow any customization here. We already have a dead-simple way to specify the labels that is infinitely customizable.

codecov-commenter commented 9 months ago

Codecov Report

Attention: 32 lines in your changes are missing coverage. Please review.

Comparison is base (8794d65) 69.85% compared to head (7dbfe52) 66.05%.

Files Patch % Lines
ext/PairPlotsDynamicQuantitiesExt.jl 0.00% 13 Missing :warning:
ext/PairPlotsDynamicUnitfulExt.jl 0.00% 13 Missing :warning:
src/PairPlots.jl 84.61% 6 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #30 +/- ## ========================================== - Coverage 69.85% 66.05% -3.80% ========================================== Files 3 5 +2 Lines 345 383 +38 ========================================== + Hits 241 253 +12 - Misses 104 130 +26 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.