【发布时间】:2020-08-02 01:57:28
【问题描述】:
我正在创建一个有趣的拼图曲线,并想从我如何编写下面的代码中了解以下内容:
数据集
Zone <- c('Overwhelm State', 'Overwhelm State', 'Puzzle Pairing State',
'Puzzle Pairing State', 'Puzzle Pairing State', 'Puzzle Pairing State',
'Puzzle Pairing State', 'Puzzle Pairing State', 'Puzzle Pairing State',
'"I can do this" State', '"I can do this" State', '"I can do this" State',
'Lost State','Lost State','Lost State','Lost State', 'Close Out State',
'Close Out State', 'Close Out State','Close Out State', 'Close Out State',
'Close Out State')
`Jigsaw Puzzle Pieces`<- c(0.20, 0.10, 0.20, 0.40, 0.80, 1.60, 3.20,
6.40, 12.80, 14.00,15.00, 18.00, 31.85, 33.50, 33.50, 31.85, 15.93,
7.96, 3.98, 1.99, 1.00, 0.50)
Date <- as.Date(c('2020-03-28','2020-03-29','2020-03-30','2020-03-31',
'2020-04-01','2020-04-02','2020-04-03','2020-04-04','2020-04-05','2020-04-06', '2020-04-07','2020-04-08','2020-04-09','2020-04-10','2020-04-11','2020-04-12',
'2020-04-13','2020-04-14','2020-04-15','2020-04-16','2020-04-17','2020-04-18'))
jigsaw_data <- data.frame(Date, `Jigsaw Puzzle Pieces`, Zone)
1) 如何更改标题的字体大小?
2) 如何从图例中删除值“系列 1”但保持线出现在图表上?
3)我如何订购图例,以便它是:
"Overwhelm State"
"Puzzle Pairing State"
"I can do this" State
"Lost State"
"Close Out State"
代码如下:
library(highcharter)
highchart() %>%
hc_add_series(jigsaw_data, type = "line", lineWidth = 10,
hcaes(x = Date, y = `Jigsaw Puzzle Pieces`)) %>%
hc_add_series(jigsaw, type = "column",
hcaes(x = Date, y = `Jigsaw Puzzle Pieces`, group = Zone)) %>%
hc_xAxis(type = 'datetime', labels = list(format = '{value:%b %d}')) %>%
hc_title(text = "<b>Jigsaw Puzzle Modelling Curve</b>") %>%
hc_subtitle(text = "<b>COVID-19 Bias<b>") %>%
hc_xAxis(title = list(text = '<b>Quarantine Period<b>',lineWidth = 3)) %>%
hc_yAxis(title = list(text = '<b>Time Required to Insert One Puzzle Piece<b>')) %>%
hc_legend(align = "right", verticalAlign = "top",
layout = "vertical", x = 0, y = 100)
【问题讨论】:
标签: r highcharts legend r-highcharter