Skip to content

Add interactivity for geom_pcp #2391

Open
@dicook

Description

@dicook

It would be elegant to be able to create interactive parallel coordinate plots with plotly layered on the ggpcp library. Users should be able to select a line (or lines) and the entire line would highlight.

library(ggplot2)
data(mtcars)
mtcars_pcp <- mtcars |>
  dplyr::mutate(
    cyl = factor(cyl),
    vs = factor(vs),
    am = factor(am),
    gear = factor(gear),
    carb = factor(carb)
  ) |>
  pcp_select(1:11) |>  # select everything
  pcp_scale() |>
  pcp_arrange()

 base <- mtcars_pcp |> ggplot(aes_pcp())


 # Just the base plot:
 base + geom_pcp()

# Ideally this would allow lines to be selected 
ggplotly() 

# Or something like:
highlight_key(mtcars) |> ... (ggplot2 code) |> ggplotly()

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