I have built this interactive plot that I would like to save to HTML. This is the code I used to build it.
def vis_pcs(M, a, b, label='album', prefix='PC', symbol=None):
fig = px.scatter(M, prefix + str(a), prefix + str(b),
color=label,
hover_name='album',
hover_data=['genre', 'song_title'],
marginal_x='box',
symbol=symbol,
height=1000)
fig.show()
I'm unsure how to save it I've used the following lines of code to save it but each throws an error:
fig.write_html(data_path+"/genre.html")
import plotly.io as pio
pio.write_html(fig, file=data_path+"/genre.html", auto_open=True)
plotly.offline.plot(fig, filename= data_path+"/genre.html")
Any help would be appreciated as for data to reproduce the graph its difficult to give but its a scatterplot