---- hist in Plotly ----

how can I put the below histogram inside plotly?

 y
 [1] 1.42118995 0.54034335 0.47359777 1.42916949 1.97552165 1.00748605 0.21951251 1.53329533 0.97395134 1.06455214 0.38681194 2.18919474 1.60048781
[14] 0.69304221 1.22592067 1.98329230 1.05767761 0.47669558 1.50858190 0.52713631 1.01026827 0.29513185 0.01062294 0.70213720 2.82288049 2.01842713
[27] 0.80970693 0.28084689 0.63179423 0.51303360 0.31157931 1.39148202 0.71256640 1.79360809 1.00078910 0.44323883 1.00353381 0.99960582 0.27709472
[40] 1.76153704 0.05000000 0.45000000 0.04000000 0.31000000 1.01000000 0.00000000 0.42000000 0.03000000 0.45000000 1.33236632 0.70668239 0.47201695
[53] 0.32000000 0.31000000 0.28000000 0.29000000 0.42000000 0.00000000 0.23000000 0.70000000 0.32756679 0.20000000 0.32000000 1.01000000 0.48000000
[66] 0.45617979 0.28000000 0.52592775 0.28000000
bins_ex
 [1] 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6
[38] 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0
 p <- hist(y, col = 'skyblue3',main=title,breaks=bins_ex,xlab='rpm',ylab='count',font.main=1)

Thanks.

You should begin by studying this documentation

You're welcome to write back for more help if you should need it. :slight_smile:

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

yes, exactly I have referred to that link before. But I find histogram using plotly is not easily customisable as what I have done below, or maybe I am wrong:

  p <- hist(y, col = 'skyblue3',panel.first=grid(),xlim=c(0,5),
            main=title,breaks=bins_ex,xlab='',ylab='',font.main=1,axes = FALSE)
       axis(1,at = seq(0,5,1),labels = TRUE,pos = 0)
       axis(2,pos = 0)
  abline(v=input$dist_ex_min,col="red",lwd=2,lty=2)
  abline(v=input$dist_ex_max,col="red",lwd=2,lty=2)
  
  # x axis
  mtext(text = "rpm",
        side = 1,line = 1)
  
  # y axis
  mtext(text = "count",
        side = 2, #side 2 = left
        line = 0.5)
  p