Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion R/ggplotly.R
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,8 @@ gg2list <- function(p, width = NULL, height = NULL,
if (xy == "x") {
## Facet labels are always on top, so add tick length to move past them
axisObj[["ticklen"]] <- axisObj[["ticklen"]] +
(unitConvert(stripText, "pixels", type) * 2.5)
(unitConvert(stripText, "pixels", type) * 3)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a magic number. I don't think ticklen can vary dynamically so it has to be large enough to accomodate large and small window sizes. It'll be too long for small window sizes but if it's extreme the user can adjust it using p %>% layout(xaxis=list(ticklen=10), xaxis2=list(ticklen=10), ...).

I'll log an issue on the plotly.js github to see if it would be possible to have ticklen optionally be a proportion of the plot rather than strictly pixels, but otherwise it's a necessary evil


axisObj[["anchor"]] <- "y"
} else if (xy == "y" && nCols > 1) {
axisObj[["anchor"]] <- paste0("x", nCols)
Expand Down