Stéphane Laurent Stéphane Laurent - 1 year ago 103
R Question

Increasing the size of the title of a plotly graphic

I'm using

plotly 4.5.2

Here is how I do to change the size of the title of the plot, by using

x <- 0:10
y <- 0:10
dd <- transform(expand.grid(x=x, y=y), z=x+y)
dd1 <- data.frame(x=x, y=y)
pp <- plot_ly() %>%
layout(title="Hello", titlefont=list(size=30)) %>%
add_trace(data=dd, x=~x, y=~y, z=~z, type="heatmap") %>%
add_trace(data=dd1, x=~x, y=~y, type="scatter", mode="lines", showlegend=FALSE)

But then the title is not correctly rendered when it is too big:

enter image description here

Is it a bug, or am I doing something bad ?

Answer Source

You can set a graph size manually. Try the following:
pp %>% layout(autosize = F, height = 500, margin = list(l=50, r=50, b=100, t=100, pad=4))

Title is visible now

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download