[英]r-plotly - Need some advice
How can I use library(plotly)
in R to bring the following plot into the web?如何在 R 中使用library(plotly)
将以下情节带入网络?
library(quantregGrowth)
data(growthData)
m6<-gcrq(y~ps(x, lambda=seq(0,100,l=20)), tau=c(0.025,0.975), n.boot=10,
data=growthData)
plot(m6)
library(ggplot2)
library(plotly)
temp <- data.frame(m6$fitted)
growthData_b <- cbind(growthData, temp)
Option 1 is to use ggplotly()
:选项 1 是使用ggplotly()
:
a <- ggplot(data=growthData_b, aes(x, y=X0.025)) +
geom_line() +
geom_line(data=growthData_b, aes(x, y=X0.975), color = "red") + theme_bw() +
ylab('fitted')
ggplotly(a)
Option 2 is to use plot_ly()
:选项 2 是使用plot_ly()
:
plot_ly() %>% add_lines(data = growthData_b, x = ~x, y = ~X0.025) %>% add_lines(data = growthData_b, x = ~x, y = ~X0.975)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.