0

This is the result I am getting currently, here the secondary y axis's title and label of values is not visible properly

plotly::plot_ly(data = india, x = ~ Date, y = ~ Daily.Confirmed,
                type = "scatter", mode = "fill",fill = "tozeroy", name = "Confirmed Cases",
                fillcolor ="#ff5c67",  line = list(color = "#94010b", width = 3))%>%
  plotly::add_trace(x = ~ Date, y = ~ Daily.Deceased, marker = list( 
                     color = "#757f80"), type = "bar", name = "Deaths",
                   yaxis = "y2")%>%
  plotly::layout(title = "",plot_bgcolor='#e5ecf6',
                 legend = list(x = 0.03, y = 0.95),
                 yaxis = list(title = "Number of Cases",zerolinecolor = '#ffff',
                              zerolinewidth = 2,
                              gridcolor = 'ffff'),
                 xaxis = list(title = "Confirmed Cases Trend",zerolinecolor = '#ffff',
                              zerolinewidth = 2,
                              gridcolor = 'ffff'),
                 yaxis2 = list(title = "Number of Deaths", overlaying = "y",
                               side = "right", range = c(0, 20000), 
                               gridcolor = "#e5ecf6"),position = 2,
                 hovermode = "compare")

Can anyone please help!

  • 3
    Please provide the data in `dput` format. Please visit [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – UseR10085 Aug 26 '21 at 05:12
  • 1
    You might want to [customize the margins](https://plotly.com/r/setting-graph-size/). – ismirsehregal Aug 26 '21 at 08:18

0 Answers0