Black Lives Matter. Please consider donating to Black Girls Code today.

Plotly R problem with Title Characteristics

I am having a problem with controlling titles in a Shiny app where I ant to increase the font size and change the default position. The Plotly pages describe how this can be done, but I cannot get it to work.

I can do this:

ylabels <- “Test Axis”

plotTtl <- paste0(" “, ylabels,” Plot ")

yaxislbl <- paste0(" ", ylabels, " ")

f1 <- list(
family = “Arial, sans-serif”,
size = 24,
color = “black”
)

f2 <- list(
family = “Arial, sans-serif”,
size = 18,
color = “black”
)

f3 <- list(
family = “Arial, sans-serif”,
size = 18,
color = “black”
)

ax <- list(
autotick = TRUE,
showine = TRUE,
title = "Process P[NC] True ",
titlefont = f1,
showticklabels = TRUE,
tickangle = 45,
tickfont = f2,
showgrid = TRUE,
zeroline = FALSE,
range = c(0, 1)
)

ay <- list(
autotick = TRUE,
showline = TRUE,
title = yaxislbl,
titlefont = f1,
showticklabels = TRUE,
tickangle = 0,
tickfont = f2,
showgrid = TRUE,
zeroline = FALSE,
range = c(0,1)
)

ptt <- list(
text = plotTtl,
titlefont = f3,
side = “top left”,
xanchor = “left”,
xref = “paper”,
yref = “paper”
)

colpal <- c(“black”)

plot_ly(data = resfile,
x = resfile$TrueNC,
y = resfile$AOQ,
colors = colpal,
type = ‘scatter’,
mode = ‘lines’
) %>% layout(title = plotTtl,
xaxis = ax,
yaxis = ay,
paper_bgcolor=‘white’,
plot_bgcolor=‘gainsboro’
) %>% config(displayModeBar = “static”,
modeBarButtonsToRemove = c(“zoomIn2d”,
“zoomOut2d”,
“autoScale2d”,
“hoverClosestCartesian”),
displaylogo = FALSE,
toImageButtonOptions = list(format = “png”,
width = 1920,
height = 1080
)
)

which puts a title at the top of the plot.

but if I try to use the ptt list of characteristics as title = ptt, I get no title at all.

I can reduce the list to just the title text in ptt and still get no plot title in the results. have also tried to put the list directly in title = list() and there is no title on the plot.