I have a table where the category titles are quite long, but I'd like them to appear when hovering.
library(data.table)
library(plotly)
testTable <-
structure(list(ACTUAL_LIFT = c(1.34, 1.21, 1.03, 2.39, 1.49,
1.32, 1.27, 1.32), PROMOTION_TITLE = c("longggggggggggggg title1",
"longggggggggggggg title2", "longggggggggggggg title3", "longggggggggggggg title4",
"longggggggggggggg title5", "longggggggggggggg title6", "longggggggggggggg title7",
"longggggggggggggg title8")), .Names = c("ACTUAL_LIFT", "PROMOTION_TITLE"
), class = c("data.table", "data.frame"), row.names = c(NA, -8L
))
a <- list(
title = "Promo"
)
b <- list(
title = "Lift"
)
p <- plot_ly(
x = testTable[, PROMOTION_TITLE],
y = (testTable[, ACTUAL_LIFT] - 1) * 100,
name = "Lifts",
type = "bar"
) %>%
layout(xaxis = a, yaxis = b)
p
...just basically looking for a xlab = NULL equivalent here. Or if there's a better way to do this, I'm open to it.
Remove the tick labels like this
p %>% layout(xaxis= list(showticklabels = FALSE))
The list of options for plotly charts is here: Plotly R Reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With