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

set some parameters to change the scale bar may be better #17

Open
zeqiandu opened this issue Jan 26, 2021 · 1 comment
Open

set some parameters to change the scale bar may be better #17

zeqiandu opened this issue Jan 26, 2021 · 1 comment

Comments

@zeqiandu
Copy link

it's a great work,but when I use this package to plot many pictures in one panel ,i want to change the legend's name "n_neighbors" to "density" . and different pictures in one panel will have different scale.i want to change the scale accoring point density to change bar scale.for example, ticks at different pictures in one panel will different

@jan-glx
Copy link
Contributor

jan-glx commented Dec 4, 2023

I have issues parsing your question but I think using current master (install with remotes::install_github("LKremer/ggpointdensity")) with aes(color=after_stat(ndensity)) will cover your needs:

library(ggplot2)

ggplot(iris[1:105,], aes(x = Sepal.Width, y = Sepal.Length)) +
  geom_point(data= function(dt) dt[, !(colnames(dt) %in% "Species")], aes(), color="gray", size=4) +
  ggpointdensity::geom_pointdensity(aes(color = after_stat(ndensity)), size=4) +
  scale_color_viridis_c(name = "scaled\ndensity") +
  facet_grid(rows = vars(Species)) +
  NULL  

Created on 2023-12-04 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants