forked from jbkunst/highcharter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhc_add_series_scatter.Rd
51 lines (38 loc) · 1.72 KB
/
hc_add_series_scatter.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api-hc-hc_add_series-deprecated.R
\name{hc_add_series_scatter}
\alias{hc_add_series_scatter}
\title{Shorcut for create scatter plots}
\usage{
hc_add_series_scatter(hc, x, y, z = NULL, color = NULL, label = NULL,
showInLegend = FALSE, ...)
}
\arguments{
\item{hc}{A \code{highchart} \code{htmlwidget} object.}
\item{x}{A numeric vector.}
\item{y}{A numeric vector. Same length of \code{x}.}
\item{z}{A numeric vector for size. Same length of \code{x}.}
\item{color}{A vector to color the points.}
\item{label}{A vector to put names in the dots if you enable the datalabels.}
\item{showInLegend}{Logical value to show or not the data in the legend box.}
\item{...}{Aditional shared arguments for the data series
(\url{http://api.highcharts.com/highcharts#series}).}
}
\description{
This function helps to create scatter plot from two numerics vectors. Options
argumets like size, color and label for points are added.
}
\examples{
\dontrun{
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}")
}
}