简体   繁体   中英

how to adjust x axis when labels in x axis are getting hidden?

I plot a graph using plotly package in R. I got the expected result but I'm facing a small issue. The plot looks like.. 看这里

My code is:

plot_ly(input_file,x=~TimeStamp,y=~No_Of_Threads,type="scatter",mode="lines",name ="Virtual Users")%>%
add_trace(x=~TimeStamp,y=~ResponseTime,mode="lines",yaxis="y2",name="ResponseTime(ms)")%>%
  layout(yaxis2 = list(overlaying = "y", side = "right"))%>%
  layout(                        
    title = "COMPOSITE TIMELINE",
    xaxis = list(       
      title = ""),     
    yaxis = list(        
      title = "VIRTUAL USERS")  
  )

But in x axis the time is getting hidden and being cut. How can I solve this so that the plot is perfect.

You could try something with the margin -attribute of the layout: https://plot.ly/r/reference/#layout-margin Set eg pad to 0 to reduce the distance of the ticklabels to the xaxis. And set b eg to 200 (default is 80). Im not able to test it cause I have no R. Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM