3

To label the line by the value of y axis. I have plotted two graph in one ,in the first i am getting my result as of my need but in second it is showing values at lower axis

how to display all value of x axis on the x plane .In my case i want to display all values from 1:18 in the x plane

ay <- list(
 tickfont = list(color = "red"),
 overlaying = "y",
 side = "right",
 title = "Modal price"
 )
 p <- plot_ly(M, x = ~Week, y = ~`Arrival(Tonnes)`,   
  type= "bar",mode= 'marker',
    marker = list(size = 10),name ="Weekly Arrival") %>%
  add_annotations(x = seq(1:18),
              y = M$`Arrival(Tonnes)`,
              text = M$`Arrival(Tonnes)`,
              xref = "x",
              yref = "y",
              showarrow = TRUE,
          
              arrowsize = .01,
              ax = 0,
              ay = -20) %>% 


     #2nd graph addition
   add_lines(x = ~Week, y = ~`Modal price`, name = "Weekly Modal  prices",   

  marker = list(size = 10), yaxis = "y2",mode="marker") %>%
           layout(
          title = "Model price vs Arrivals in Weeks", yaxis2 = ay,
          xaxis = list(title="Weeks") ) %>% 
 ##Problem here the values are not attaching with the graph continuity 
  
 add_annotations(x=M$Week,y=M$`Modal price`,text=M$`Modal    
   price`,xref="x",yref="y",
                showarrow=TRUE,arrowsize=0.1,ax=20,ay=-20)   
 
Community
  • 1
  • 1

0 Answers0