Dear Nevil,

Although I am a bit unfamiliar with 
plotly, it seems it is possible to plot 
two bars side by side at least:

        h <- df[3:4,]
        p <- plotly::plot_ly(
          data = h,
          x =  ~ x,
          y =  ~ y,
          type = "bar")
        p <- plotly::layout(p=p,
          xaxis = list(range = c(0,20)),
          title = "example 4 two bars side by side")
        plotly::orca(p=p, file="amos4.png")

Thus, if you want to only plot x=3 and 
x=11 you need to set y=0 when x=4:10:

        h <- df[c(3, 11),]
        h <- rbind(h, cbind(x=4:10, y=0))
        p <- plotly::plot_ly(
          data = h,
          x =  ~ x,
          y =  ~ y,
          type = "bar")
        p <- plotly::layout(p=p,
          xaxis = list(range = c(0,20)),
          title = "example 2 corrected")
        plotly::orca(p=p, file="amos2.png")

I think this has to do with the xaxis 
option in plotly::layout there, and not 
with the bar width.

Best,
Rasmus

Attachment: signature.asc
Description: PGP signature

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to