SNT
SNT

Reputation: 1433

Modify y axis on plotly

I have a plot using plotly r . As of now the variations cant be seen that much. So in order to do so if the y-axis is 0-70% is there a way to show just 50%-70% on y axis so the variation can be seen more clearly. Below is code I am using

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)})

enter image description here

Upvotes: 0

Views: 768

Answers (1)

MLavoie
MLavoie

Reputation: 9886

You don't provide a reproducible example so it is hard to test, but you could try:

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)}) 

Upvotes: 1

Related Questions