Reputation: 7879
Is there a way to change the legend size in plotly for R? I have not come across this option. I have looked at the docs on legends, https://plot.ly/r/legend/, but it does not mention this.
Upvotes: 22
Views: 51425
Reputation: 139
While working with legends, there are two pieces to configure.
Let's say you already have a fig(it can be mostly any plot), to that add below line with parameters as you wish, in separate dictionaries.
fig.update_layout(legend = dict(font = dict(family = "Courier", size = 50, color = "black")),
legend_title = dict(font = dict(family = "Courier", size = 30, color = "blue")))
This way you will have more control over two thing.
Upvotes: 13
Reputation: 186
Use layout(legend = list(font = list(size(30))))
:
plot_ly(data = mtcars, x = as.character(mtcars$cyl),
y = mtcars$mpg, type = "box", color = as.character(mtcars$cyl)) %>%
layout(showlegend = TRUE, legend = list(font = list(size = 30)))
Upvotes: 17