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

unable to use cmapplot continuous color palettes for fill aesthetic #119

Closed
tkoyejo opened this issue Mar 2, 2021 · 6 comments · Fixed by #131
Closed

unable to use cmapplot continuous color palettes for fill aesthetic #119

tkoyejo opened this issue Mar 2, 2021 · 6 comments · Fixed by #131
Assignees
Labels
bug Something isn't working
Milestone

Comments

@tkoyejo
Copy link

tkoyejo commented Mar 2, 2021

I wanted to apply the built-in CMAP continuous palette to produce a continuous gradient fill aesthetic in a stacked bar chart. When I apply cmap_fill_continuous(palette = "seq_blues") to a stacked bar chart, I get the following error: "Error: Discrete value supplied to continuous scale". If I switch to cmap_color_continuous(palette = "seq_red_purple"), the code is ignored and the default ggplot colors are used.

I ended up having to use the ggplot color brewer, which worked. The example output I seek is attached.
scale_fill_brewer(palette = "Blues")

figure17_title

@matthewstern matthewstern added the bug Something isn't working label Mar 2, 2021
@matthewstern
Copy link
Contributor

@gritzenthaler, this is a bit of a different color application than we had originally scoped and tested. Is this code modifiable to enable the application of a continuous palette to a discrete set of categories?

@gritzenthaler
Copy link
Contributor

Yes I believe we talked about this sort of application a while ago, particularly in regards to choropleth maps. I'm sure it's possible, so I'll look into it once I have some time in the coming week.

@matthewstern
Copy link
Contributor

Is this the same issue as #70?

@tkoyejo
Copy link
Author

tkoyejo commented Mar 29, 2021

If I'm reading this right, sounds like the same issue to me.

@matthewstern matthewstern added this to the v1.2 milestone Mar 29, 2021
@matthewstern
Copy link
Contributor

@gritzenthaler for the time being I've assigned you to both issues and added both to the v1.2 milestone. Feel free to close one or the other if you determine them to be duplicates.

@dlcomeaux
Copy link
Contributor

@gritzenthaler @matthewstern I was trying to add a discrete argument to the cmap_*_continuous family, and then I realized - is there any reason that we couldn't just combine the two palette lists (or rather, the cmap_palettes and cmap_gradients) lists? I did a test with that, and it was able to use the sequences and the diverging sequences in the manner we want. We'd probably want some additional code to flag when a palette is being used inappropriately (and perhaps we should only allow for the gradients to be used as palettes and not vice versa), but I think that would achieve what we want with only minimal change required.

I'll start prepping what it would look like.

@dlcomeaux dlcomeaux linked a pull request May 11, 2021 that will close this issue
@nmpeterson nmpeterson mentioned this issue Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants