ggobi / ggally

R package that extends ggplot2
http://ggobi.github.io/ggally/
584 stars 119 forks source link

Support color mapping for continuous variable in scatter plots #505

Open Ductmonkey opened 1 month ago

Ductmonkey commented 1 month ago

GGpairs supports mapping color to categorical variables but it seems not for continuous variables. This could make the visualization much more powerful to help expose 3-dimensional correlations (or lack thereof).

Is it possible to allow this for panels where it would be sensible (i.e. scatter plot) and leave other panels black?

library(GGally)

# works fine for categorical variables
ggpairs(iris, columns = 1:4, aes(color = Species))


# fails on continuous variables
ggpairs(iris, columns = 1:4, aes(color = Sepal.Length))
#> Warning: The following aesthetics were dropped during statistical transformation: fill
#> ℹ This can happen when ggplot fails to infer the correct grouping structure in
#>   the data.
#> ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
#>   variable into a factor?
#> Error in ggally_statistic(data = data, mapping = mapping, na.rm = na.rm, : `mapping` color column must be categorical, not numeric

Created on 2024-08-06 with reprex v2.0.2