I'm building an html page with a plot made with plot_ly and under it I have some buttons connected to the data of the plot. Here is the layout so far.
I would like to fit the plot fully in the box.
Also, I would like to know why every time I'm double clicking the plot in the html page, it will be resized as the picture below. Is it a bug or is there a way to solve this issue?
This is part of my code:
p<-plot_ly(data = df, x = ~sample1, y = ~sample2, type = "scatter", mode = "markers", width = 600, height = 700,
marker = list(symbol = "cross",size = 4, opacity = 0.5, color = "rgba(50,50,50,0.5)",alpha = I(0.8)))
#HTML code plot
html_plot <- tags$div(
style = paste0(
"width: ", "700px", "; ",
"height: ", "700px", "; ",
"border: 1px solid black;"
),
p
)
#HTML complete code
html_code <- tagList(
tags$h1(plot_title),
html_plot,
tags$p(plot_caption),
tags$button(
onclick = "toggleTable()",
"Show/Hide data"
),
tags$button(
onclick = "copyTable()",
"Copy data"
),
html_table,
HTML(html_script)
)