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

Tweak nominal scale axes akin to categorical axes in classic seaborn #3069

Merged
merged 1 commit into from
Oct 12, 2022

Conversation

mwaskom
Copy link
Owner

@mwaskom mwaskom commented Oct 9, 2022

Closes #2967

Three changes:

  • Margins are now an additive 0.5 rather than a multiplicative 0.05
  • Grids are disabled
  • Y axis is inverted
(
    so.Plot(tips, x="total_bill", y="time")
    .add(so.Dots(), so.Jitter())
    .layout(size=(6, 3))
)

Current:

With this change:

We'll want to allow users to override the grid parameterization. I think we'll need an API for that that is separate from Plot.theme and I'm not exactly sure where it should be off the top of my head. Plot.layout or on the Nominal object itself are two ideas.

I'd also still like this to be supported as a first-class operation in matplotlib, but I'm not sure how likely that is.

It feels like a bit of a hack to have this logic live in Plot._finalize_figure with an instance check on the Scale. Alternatively, we could put the logic in the Scale object and have _finalize_figure call into it. Maybe something to revisit once we either want other scale-specific tweaks or when the extension API is formally opened up.

@codecov
Copy link

codecov bot commented Oct 9, 2022

Codecov Report

Merging #3069 (e99a1e4) into master (54cab15) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3069   +/-   ##
=======================================
  Coverage   98.38%   98.39%           
=======================================
  Files          74       74           
  Lines       23648    23673   +25     
=======================================
+ Hits        23267    23292   +25     
  Misses        381      381           
Impacted Files Coverage Δ
seaborn/_core/plot.py 99.32% <100.00%> (+<0.01%) ⬆️
tests/_core/test_plot.py 98.66% <100.00%> (+0.01%) ⬆️

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.

Nominal scale should be drawn the same way as categorical scales
1 participant