Ugly space between plot and title

Hey :slight_smile:
I’ve got the following code:

fig <- div(plot_ly(data=linm7, y = rownames(linm7), x = linm7$Estimate,type = 'scatter', mode = 'markers', name = "Estimated interaction effect", error_x= ~list(array=linm7[,2],color = '#000000'), color=sort(rv),colors=c(rep('#48AAAD',28),rep("#F79862", length(rownames(linm7))-28)), showlegend=FALSE, width = 950, height = 3700,hoverinfo = 'text', text = paste0("Interaction effect of '", rownames(linm7),"' on arrival delay: ", linm7$Estimate," (±",linm7[,2],")")) %>%
    add_annotations(y=rownames(linm7),xref = 'paper',x=1.375,text=pval,showarrow = FALSE,font = list(size = 8),color=I("black")) %>%
    add_annotations(y=rownames(linm7),xref = 'paper',x=1.15,text=txt,showarrow = FALSE,font = list(size = 9.5),color=I("black")) %>%
    layout(autosize=F, yaxis=list(title="", categoryorder = "array",
              categoryarray = rev(rownames(linm7)), ticktext=rev(rownames(linm7))),xaxis = list(title =paste0("Estimated interaction effect on arrival delay (min)")), margin=list(l=600, b=20,t=35, r=120), title="Estimated interaction effect of airlines and origin airports on arrival delay (with standard error)"), align = "center")
fig

Unfortunately, it creates a ugly space between the plot and the title (see picture).

Plotly

Any advices? The margins are not the problem, I’ve already tried different ones and nothing changes.
Thank you very much!
Best wishes

I’ve found a solution:
If you insert the parameter “range” within your layout>yaxis parameter and you set it “c(1,length(names_yaxis))” - which in my case is c(1,199) - it works. Here the code:

fig <- div(plot_ly(data=linm7, y = rownames(linm7), x = linm7$Estimate,type = 'scatter', mode = 'markers', name = "Estimated interaction effect", error_x= ~list(array=linm7[,2],color = '#000000'), color=sort(rv),colors=c(rep('#48AAAD',28),rep("#F79862", length(rownames(linm7))-28)),showlegend=FALSE, width = 950, height = 3700,hoverinfo = 'text', text = paste0("Interaction effect of '", rownames(linm7),"' on arrival delay: ", linm7$Estimate," (±",linm7[,2],")")) %>%
    add_annotations(y=rownames(linm7),xref = 'paper',x=1.375,text=pval,showarrow = FALSE,font = list(size = 8),color=I("black")) %>%
    add_annotations(y=rownames(linm7),xref = 'paper',x=1.15,text=txt,showarrow = FALSE,font = list(size = 9.5),color=I("black")) %>%
    layout(autosize=F, yaxis=list(range=c(1,199),title="", categoryorder = "array",
              categoryarray = rev(rownames(linm7)), ticktext=rev(rownames(linm7))),xaxis = list(tickangle=45,title =paste0("Estimated interaction effect on arrival delay (min)")), margin=list(l=600, b=20,t=35, r=120), title="Estimated interaction effect of airlines and origin airports on arrival delay (with standard error)"), align = "center")