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

Use of aes(color=category) in geom_density or geom_hist #102

Closed
dmbates opened this issue May 3, 2024 · 5 comments · Fixed by #103 or #121
Closed

Use of aes(color=category) in geom_density or geom_hist #102

dmbates opened this issue May 3, 2024 · 5 comments · Fixed by #103 or #121
Assignees
Labels
enhancement New feature or request

Comments

@dmbates
Copy link

dmbates commented May 3, 2024

Describe how it works in R's ggplot2
A clear and concise description of what you want to happen.

If x is a numeric variable and g is a factor in data.frame df in R then ggplot(df, aes(x = x, color=g) + geom_density() produces a plot with multiple kernel density estimates. See the diamonds example in https://ggplot2.tidyverse.org/reference/geom_density.html

In TidierPlots.jl it seems that the color/colour aesthetic is interpreted as a scalar color by geom_density.

Is there a way to create a plot with multiple kernel density curves in TidierPlots.jl?

BTW, @rdboyes It is great to see someone from the Kingston area (are you on Wolfe Island?) in Julia development. I did both my undergraduate degree and my Ph.D. at Queens.

@dmbates dmbates added the enhancement New feature or request label May 3, 2024
@rdboyes
Copy link
Member

rdboyes commented May 3, 2024

Yep! Wolfe Island - just finished my Ph.D at Queen's last year.

Thanks for reporting this - it's another issue downstream of the grouping issue (like #93) - looks like @adknudson has an idea how to fix it over there so we should have this working soon!

@rdboyes
Copy link
Member

rdboyes commented May 5, 2024

In dev branch now:

ggplot(penguins) +
         geom_density(aes(x = :bill_length_mm, color = :island))

image

@dmbates
Copy link
Author

dmbates commented Jul 18, 2024

This seems to have reverted to the earlier behavior. Using TidierPlots v0.7.7 or the main branch of this repository, I get
display

@rdboyes
Copy link
Member

rdboyes commented Jul 18, 2024

Interesting - it seems to be plotting all three curves independently, but all in blue. I'll look into this change - it could be due to the new version of Makie? But I'm not sure yet

@rdboyes
Copy link
Member

rdboyes commented Sep 18, 2024

This is "re-fixed" in 0.8.0 (to be released soon)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants