hc_add_series_scatter {highcharter} | R Documentation |
This function helps to create scatter plot from two numerics vectors. Options argumets like size, color and label for points are added.
hc_add_series_scatter(hc, x, y, z = NULL, color = NULL, label = NULL, showInLegend = FALSE, ...)
hc |
A |
x |
A numeric vector. |
y |
A numeric vector. Same length of |
z |
A numeric vector for size. Same length of |
color |
A vector to color the points. |
label |
A vector to put names in the dots if you enable the datalabels. |
showInLegend |
Logical value to show or not the data in the legend box. |
... |
Aditional shared arguments for the data series (http://api.highcharts.com/highcharts#series). |
## Not run: hc <- highchart() hc_add_series_scatter(hc, mtcars$wt, mtcars$mpg) hc_add_series_scatter(hc, mtcars$wt, mtcars$mpg, mtcars$drat) hc_add_series_scatter(hc, mtcars$wt, mtcars$mpg, mtcars$drat, mtcars$am) hc_add_series_scatter(hc, mtcars$wt, mtcars$mpg, mtcars$drat, mtcars$qsec) hc_add_series_scatter(hc, mtcars$wt, mtcars$mpg, mtcars$drat, mtcars$qsec, rownames(mtcars)) # Add named attributes to data (attributes length needs to match number of rows) hc_add_series_scatter(hc, mtcars$wt, mtcars$mpg, mtcars$drat, mtcars$qsec, name = rownames(mtcars), gear = mtcars$gear) %>% hc_tooltip(pointFormat = "<b>{point.name}</b><br/>Gear: {point.gear}") ## End(Not run)