我有一个使用plotly r的图。到目前为止,这种变化还看不到太多。因此,如果这样做,如果y轴为0-70%,则可以在y轴上仅显示50%-70%,这样可以更清楚地看到变化。 以下是我正在使用的代码
output$plot <- renderPlotly({
if (is.null(ab()))
return(NULL)
y <- list(title = "Percentange")
x <- list(title = "Months")
plot_ly(ab(), x = ~ Month_considered, y = ~ pct * 100,type = 'scatter', mode = 'marker',
fill = 'tozeroy', line = list(color = 'rgb(205, 12, 24)', width = 4)) %>%layout(xaxis = x, yaxis = y)})
答案 0 :(得分:1)
您没有提供可复制的示例,因此很难测试,但是您可以尝试:
y <- list(title = "Percentage", range = c(50,70))
plot_ly(ab(), x = ~ Month_considered, y = ~ pct * 100,type = 'scatter', mode = 'marker', fill = 'tozeroy', line = list(color = 'rgb(205, 12, 24)', width = 4)) %>% layout(xaxis = x, yaxis = y)})