ggpointdensity icon indicating copy to clipboard operation
ggpointdensity copied to clipboard

set some parameters to change the scale bar may be better

Open zeqiandu opened this issue 3 years ago • 1 comments

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

zeqiandu avatar Jan 26 '21 03:01 zeqiandu

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

jan-glx avatar Dec 04 '23 16:12 jan-glx