I want to hide the y-axis title from a plot, and have the margin adjusted to avoid unnecessary white space where the title would have been.
In ggplot2, this happens automatically:
library(ggplot2) dat <- data.frame(x = c(1:5), y = c(1:5)^2) gg <- ggplot(dat, aes(x, y)) + geom_point() + theme(axis.title.y = element_blank())
However, plotly (here: ggplotly) does not seem to have the same behavior:
library(plotly) pl <- ggplotly(gg)
I’ve been trying to adjust the
margin argument, as well as
automargin, but I have so far not been able to reduce the left margin as I would like. How can I achieve this using R and plotly?