Plotly: How to save interactive plotly plot as pdf file?

Viewed 729

I created an interactive plot using plotly as following:

tracer_red = go.Scatter(x=Xedges_red, y=Yedges_red,
                    mode='lines',
                    line= dict(color="#FA0000", width=1),
                    hoverinfo='none',
                    showlegend=False)
# positive:
tracer_green = go.Scatter(x=Xedges_green, y=Yedges_green,
                    mode='lines',
                    line= dict(color= "#29A401", width=1),
                    hoverinfo='none',
                    showlegend=False)
                    
# nodes
tracer_marker = go.Scatter(x=Xnodes, y=Ynodes,
                           mode='markers+text',
                           textposition='middle center',
                           marker=dict(size=node_size,
                           line=dict(width=0.8, color='black'),
                           color=node_colour, symbol=node_shape),
                           hovertext=description,
                           hoverinfo='text',
                           text=node_label,
                           textfont=dict(size=10),
                           showlegend=False)

axis_style = dict(title='',
                  titlefont=dict(size=20),
                  showgrid=False,
                  zeroline=False,
                  showline=False,
                  ticks='',
                  showticklabels=False)

layout = dict(title='',
              width=1300,
              height=900,
              autosize=False,
              showlegend=False,
              xaxis=axis_style,
              yaxis=axis_style,
              hovermode='closest',
             plot_bgcolor = '#fff')

fig = dict(data=[tracer_red, tracer_green, tracer_marker], layout=layout)
display(HTML("""<p>Node sizes are proportional to the size of annualised returns.<br>
                Node colours signify positive or negative returns since beginning of the timeframe.</p> """))
plot(fig)

I want to save the plot as a pdf file or as a picture. when I saveing with the "camera" it saveing in a very low resulotion enter image description here

because I created the fig as a dict, I cant us the command fig.write_image() do you know other way to save the fig as a pic\PDF file?

Thank you!

0 Answers
Related