forked from jbkunst/highcharter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscatter-ex.R
24 lines (22 loc) · 1.12 KB
/
scatter-ex.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
highchart() %>%
hc_add_series_scatter(cars$speed, cars$dist)
highchart() %>%
hc_add_series_scatter(mtcars$wt, mtcars$mpg, mtcars$cyl) %>%
hc_chart(zoomType = "xy") %>%
hc_title(text = "Motor Trend Car Road Tests") %>%
hc_xAxis(title = list(text = "Weight"), minorTickInterval = "auto") %>%
hc_yAxis(title = list(text = "Miles/gallon")) %>%
hc_tooltip(headerFormat = "<b>{series.name} cylinders</b><br>",
pointFormat = "{point.x} (lb/1000), {point.y} (miles/gallon)")
highchart() %>%
hc_add_series_scatter(mtcars$wt, mtcars$mpg, car = rownames(mtcars),
hp = mtcars$hp, gear = mtcars$gear) %>%
hc_chart(zoomType = "xy") %>%
hc_title(text = "Motor Trend Car Road Tests") %>%
hc_xAxis(title = list(text = "Weight"), minorTickInterval = "auto") %>%
hc_yAxis(title = list(text = "Miles/gallon")) %>%
hc_tooltip(pointFormat = "<b>{point.car}</b><br/>
Weight: {point.x} lb/1000<br/>
MPG: {point.y}<br/>
Horsepower: {point.hp}<br/>
Forward gears: {point.gear}")