mwaskom / seaborn

Statistical data visualization in Python
https://seaborn.pydata.org
BSD 3-Clause "New" or "Revised" License
12.59k stars 1.93k forks source link

added a dict return to choose_diverging_pallete function #3754

Closed athyrson06 closed 2 months ago

athyrson06 commented 2 months ago

Title: Fix Incompatibility Between seaborn.diverging_palette and seaborn.choose_diverging_palette() Description: I noticed a divergence between the functions seaborn.diverging_palette and seaborn.choose_diverging_palette() in Seaborn. Specifically, while the documentation for seaborn.diverging_palette references seaborn.choose_diverging_palette() as a tool for selecting a palette interactively, the output from choose_diverging_palette() is not directly compatible with diverging_palette().

Issue: Function Reference: The documentation suggests that the interactive palette created using choose_diverging_palette() can be passed directly to diverging_palette(). However, attempting to do so leads to errors or unexpected behavior because the output format of choose_diverging_palette() does not match the expected input for diverging_palette(). Impact: This issue may cause confusion among users and disrupt workflows that rely on seamless integration between these two functions. Proposed Solution: Documentation Update: Clarify the documentation for seaborn.diverging_palette to accurately describe the relationship between these two functions and how to correctly use the output from choose_diverging_palette() with diverging_palette(). Function Compatibility: Consider updating choose_diverging_palette() to return a format that is directly compatible with diverging_palette(), or provide a helper function to convert the output appropriately. Additional Notes: I have attached a small example illustrating the issue and how it can be resolved. Please let me know if there are additional tests or documentation changes you would like to see in this PR. Thank you for considering this update.

This draft highlights the key issue, suggests a potential solution, and invites further discussion or feedback. Feel free to adjust it according to the specifics of your findings and any particular changes you're proposing.

mwaskom commented 2 months ago

The documentation suggests that the interactive palette created using choose_diverging_palette() can be passed directly to diverging_palette()

Not sure where you're getting that? The return type is documented as

pal or cmaplist of colors or matplotlib colormap
    Object that can be passed to plotting functions

Aside from that, this change can't be accepted as it would need to be applied in all of the choose_*_palette functions, not just the diverging one.

That said, I don't think people use these much and we're probably going to get rid of them.