Learn R Programming

highcharter (version 0.3.0)

hc_add_series_scatter: Shorcut for create scatter plots

Description

This function helps to create scatter plot from two numerics vectors. Options argumets like size, color and label for points are added.

Usage

hc_add_series_scatter(hc, x, y, z = NULL, color = NULL, label = NULL, showInLegend = FALSE, viridis.option = "D", ...)
hc_add_serie_scatter(hc, x, y, z = NULL, color = NULL, label = NULL, showInLegend = FALSE, viridis.option = "D", ...)

Arguments

hc
A highchart htmlwidget object.
x
A numeric vector.
y
A numeric vector. Same length of x.
z
A numeric vector for size. Same length of x.
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.
viridis.option
Palette to use in case the color. Argument can not be NULL in the case of use color argument. Options are A, B, C, D.
...
Aditional shared arguments for the data series (http://api.highcharts.com/highcharts#series).

Examples

Run this code

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))

Run the code above in your browser using DataLab