通过rCharts格式化Highcharts打印
我在从rCharts工作中获取highchart绘图时遇到了一些问题。我的数据和预期的图表如下:通过rCharts格式化Highcharts打印,r,highcharts,rcharts,R,Highcharts,Rcharts,我在从rCharts工作中获取highchart绘图时遇到了一些问题。我的数据和预期的图表如下: set.seed(123134) y <- rnorm(20, 35, 4) y[7] <- NA y[13] <- NA y <- rbind(t(t(y)), t(t(rep(NA, 10)))) fc <- rnorm(10, 35, 1) fc <- rbind(t(t(rep(NA,20))), t(t(fc))) uci <- rnorm(10,
set.seed(123134)
y <- rnorm(20, 35, 4)
y[7] <- NA
y[13] <- NA
y <- rbind(t(t(y)), t(t(rep(NA, 10))))
fc <- rnorm(10, 35, 1)
fc <- rbind(t(t(rep(NA,20))), t(t(fc)))
uci <- rnorm(10, 38, 1)
uci <- rbind(t(t(rep(NA,20))), t(t(uci)))
lci <- rnorm(10, 32, 1)
lci <- rbind(t(t(rep(NA,20))), t(t(lci)))
plotData <- data.frame(y,fc,uci,lci)
h1 <- Highcharts$new()
h1$chart(type="line")
h1$series(data=plotData$y)
h1$series(data=plotData$fc)
h1$series(data=plotData$uci)
h1$series(data=plotData$lci)
h1$series(data=rep(30,30))
h1
set.seed(123134)
yHi@user2691669欢迎来到SO。我将试着回答你的4个问题
要设置样式,请使用带有选项symbol=您的样式的标记
要删除标记,请使用启用选项=FALSE
要在图例中不显示序列,请使用showInLegend=FALSE
要插入缺失的值,我能提供的最好方法是connectNulls=TRUE
您可以编写代码来实现上述功能,如下所示:
set.seed(123134)
y <- rnorm(20, 35, 4)
y[7] <- NA
y[13] <- NA
y <- rbind(t(t(y)), t(t(rep(NA, 10))))
fc <- rnorm(10, 35, 1)
fc <- rbind(t(t(rep(NA,20))), t(t(fc)))
uci <- rnorm(10, 38, 1)
uci <- rbind(t(t(rep(NA,20))), t(t(uci)))
lci <- rnorm(10, 32, 1)
lci <- rbind(t(t(rep(NA,20))), t(t(lci)))
plotData <- data.frame(y,fc,uci,lci)
h1 <- Highcharts$new()
h1$chart(type="line")
h1$series(data=plotData$y, marker = list(symbol = 'circle'), connectNulls = TRUE)
h1$series(data=plotData$fc, marker = list(symbol = 'circle'), connectNulls = TRUE)
h1$series(data=plotData$uci, showInLegend = FALSE, marker = list(symbol = 'square'), connectNulls = TRUE)
h1$series(data=plotData$lci, showInLegend = FALSE, marker = list(symbol = 'square'), connectNulls = TRUE)
h1$series(data=rep(30,30), marker= list(enabled = FALSE))
h1
set.seed(123134)
Y