【发布时间】:2021-10-09 02:08:45
【问题描述】:
如何在add_trace 函数中增加绿线 (lcl) 和红线 (lsl) 的长度,使它们延伸到绘图的末尾(而不是中途停止)?
这是我的图表代码:
output$p <- renderPlotly({
plot1 %>%
add_trace(y = lcl(),type = "scatter", mode = "lines", line = list(color = 'lightgreen', width = 2, dash = 'solid'), inherit = FALSE, name = paste("LCL =", lcl()[1])) %>%
add_trace(y = lsl(),type = "scatter", mode = "lines", line = list(color = 'red', width = 2, dash = 'solid'), inherit = FALSE, name = paste("LSL =", lsl()[1])) %>%
%>%
layout(
title = paste(" cell culture", input$select),
yaxis = list( showline = TRUE,
mirror = "ticks",
linecolor = toRGB("grey"),
linewidth = 1.85
),
xaxis = list( showline = TRUE,
mirror = "ticks",
linecolor = toRGB("grey"),
linewidth = 1.85,
tickangle=70))
})
编辑:为简单起见,我去掉了实际绘图(散点图)的代码,该图很好,不需要任何调整。
【问题讨论】:
-
看来您在另一个question 中使用了我下面的答案。请务必接受并支持您认为有帮助的答案。