Black Lives Matter. Please consider donating to Campaign Zero's mission of ending police violence in America.

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]))

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).