Skip to content

Support color mapping for continuous variable in scatter plots #505

@Ductmonkey

Description

@Ductmonkey

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions