How to set dpi in plotly charts

I’m trying to add dpi option in plotly charts.

How to set dpi option in plotly charts.

My code.

import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(go.Bar(x=[“Apple”, ‘Mango’, ‘Banana’], y=[4000, 3000, 5000]))

fig.show()

I’m not sure whether it answers your question, but you can set a number of pixels for the width and / or height of your figure when exporting to an image format (fig.to_image).

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online