这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@mwaskom
Copy link
Owner

@mwaskom mwaskom commented Jun 1, 2022

This ties up some loose ends from #2413 and #2447, which allowed them to apply a continuous mapping to the hue variable without upgrading the legend machinery to properly show a colorbar-like legend. Now that works as expected:

sns.catplot(diamonds, x="cut", y="price", hue="carat", jitter=.4, s=5)

image

The solution is a bit of a shortcut, simply making _CategoricalPlotterNew subclass _RelationalPlotter, where the relevant method for creating legend artists lives. Probably that method should be moved down to the base class level to keep a cleaner division between the modules (but also, the distributions module has a different approach altogether). Legends remain a mess.

@mwaskom mwaskom added this to the v0.12.0 milestone Jun 1, 2022
@codecov
Copy link

codecov bot commented Jun 1, 2022

Codecov Report

Merging #2828 (d2913f2) into master (fefd940) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2828   +/-   ##
=======================================
  Coverage   98.04%   98.05%           
=======================================
  Files          68       68           
  Lines       21991    22014   +23     
=======================================
+ Hits        21561    21585   +24     
+ Misses        430      429    -1     
Impacted Files Coverage Δ
seaborn/relational.py 99.69% <ø> (ø)
seaborn/categorical.py 98.32% <100.00%> (+0.08%) ⬆️
seaborn/tests/test_categorical.py 99.77% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fefd940...d2913f2. Read the comment docs.

@mwaskom mwaskom merged commit dce3150 into master Jun 2, 2022
@mwaskom mwaskom deleted the cat/scatter_legend branch June 2, 2022 01:09
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.

2 participants