7

My current graph's hover-info is rotated slightly (see image below). That is, when I hover over a bar, the hover text is rotated about 60 degrees from horizontal (e.g. see the 2nd bar down in the image). How can I set the rotation to 0?

# sample data
tbl = data.frame(list_id = c(1,2,3,4,5,1,2,3,4,5,1,2,3,4,5), 
             main_count = c(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3),
             total = c(23,34,66,22,66,88,55,44,22,11,33,55,43,22,55))

plot_ly(tbl, type = "bar",
  y = main_count, x = total, group = list_id, orientation = "h") %>%
  layout(xaxis = list(title = ""), barmode = "stack")

stacked bar chart with rotated labels

Jota
  • 17,281
  • 7
  • 63
  • 93
DLo
  • 221
  • 1
  • 3
  • 7
  • 2
    If you want help with code you should show the code you are running. Create a minimal [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – MrFlick Mar 24 '16 at 21:37
  • 4
    In Chrome, when I right-click the topmost bar (so it's hover-text is visible), and choose "Inspect Element," I can see a few opening tags of this form: ``. There are two other similar tags for the topmost bar. You can manually edit the attribute to `rotate(0)`, just to see that it is controlling the rotation of each bit of text within that `` tag. Unfortunately, it's not immediately clear to me how to set the rotation from R. – Jota Mar 25 '16 at 02:10

1 Answers1

1

If you download the plotly(i'm using plotly.js), you can change the degree at : YANGLE: 60, however when they are close, it gonna cover each other if you wanna the hovertext to be up above or horizontal