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

Add Scale.label interface for formatting ticks #2877

Merged
merged 17 commits into from
Jun 26, 2022
Merged

Add Scale.label interface for formatting ticks #2877

merged 17 commits into from
Jun 26, 2022

Conversation

mwaskom
Copy link
Owner

@mwaskom mwaskom commented Jun 25, 2022

e.g.

(
    so.Plot(tips, "total_bill")
    .add(so.Bar(), so.Hist())
    .scale(x=so.Continuous().label(like="${x:.0f}"))
)

image

(
    so.Plot(planets, "distance")
    .add(so.Bar(), so.Hist())
    .scale(x=so.Continuous().label(unit="pc"))
)

image

This also makes log transformed scales default to a log formatter (closes #2840)

(
    so.Plot(planets, "distance")
    .add(so.Bar(), so.Hist())
    .scale(x="log")
)

image

This also shortens the transform Scale parameter to trans, as testing revealed that typing out transform is a little cumbersome.

@codecov
Copy link

codecov bot commented Jun 25, 2022

Codecov Report

Merging #2877 (d62a218) into master (ecba2dc) will increase coverage by 0.02%.
The diff coverage is 97.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2877      +/-   ##
==========================================
+ Coverage   98.13%   98.15%   +0.02%     
==========================================
  Files          69       69              
  Lines       22271    22400     +129     
==========================================
+ Hits        21855    21987     +132     
+ Misses        416      413       -3     
Impacted Files Coverage Δ
tests/test_categorical.py 99.77% <ø> (ø)
seaborn/_core/plot.py 94.60% <94.44%> (ø)
seaborn/_core/scales.py 89.52% <94.92%> (+2.70%) ⬆️
seaborn/_core/properties.py 99.15% <100.00%> (ø)
seaborn/_marks/base.py 98.26% <100.00%> (+0.68%) ⬆️
seaborn/_stats/histograms.py 98.82% <100.00%> (ø)
tests/_core/test_plot.py 98.39% <100.00%> (ø)
tests/_core/test_scales.py 100.00% <100.00%> (ø)

@mwaskom mwaskom force-pushed the scales/label branch 2 times, most recently from 8f77747 to e2b7777 Compare June 26, 2022 14:42
@mwaskom mwaskom added this to the v0.12.0 milestone Jun 26, 2022
@mwaskom
Copy link
Owner Author

mwaskom commented Jun 26, 2022

Docs still need some tweaking but merging to do that on the pydata-theme branch.

@mwaskom mwaskom merged commit c2270e7 into master Jun 26, 2022
@mwaskom mwaskom deleted the scales/label branch June 26, 2022 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Seaborn objects log/symlog scales - default ticks
1 participant