The convenience function fdplotly helps to extract the relevant HTML from a plotly plot via json (don't forget json! see examples); you can then place it using \textoutput (see examples). The fdplotly function takes two optional keyword arguments:
id: the name of the div in which the plot should be placed (randomly generated by default),
style: a CSS string specifying the style of the div, by default "width:600px;height:350px"
We show some examples drawn from the PlotlyJS examples.
plt = linescatter1()
fdplotly(json(plt), style="width:400px;height:250px;margin-left:auto;margin-right:auto;")
plt = batman()
fdplotly(json(plt))