Hello,
I would plot a scatter graph with 2 grouping variables with R highcharter package : name and type
name variable would be the color of points, type variable should be the point marker
here a sample data :
library(highcharter)
df = data.frame(name = c("model1", "model2", "model3","model1", "model2", "model3"),
height = c(20.22,10.33,5.6666,35.444,55.1212,60.1212),
weight = c(14.444,10.6666,11,30.6666,60.444,70.1212),
type=c("cor","cor","cor","raw","raw","raw")
)
The legend should have this 2 differents entries (as in ggplot2 package) list of model - and list of type See ggplot graph below :
highchart() %>%
hc_add_series(subset(df,type=="cor"), type = "scatter", hcaes(x = weight, y = height,group=name), showInLegend = TRUE) %>%
hc_add_series(subset(df,type=="raw"), type = "scatter", hcaes(x = weight, y = height,group=name), showInLegend = TRUE) %>%
hc_legend(align = "left",verticalAlign = "top",layout = "vertical")
How to do this in a simple way with highcharter package ?
many thanks