You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/python/static-image-export.md
+48
Original file line number
Diff line number
Diff line change
@@ -211,3 +211,51 @@ fig = dict({
211
211
pio.write_image(fig, "fig.png")
212
212
~~~
213
213
<!-- #endregion -->
214
+
215
+
## Image Export Settings
216
+
217
+
As well as configuring height, width, and other settings by passing arguments when calling `write_image` and `to_image`, you can specify defaults to be used.
218
+
219
+
### Available Settings
220
+
221
+
The following settings are availble.
222
+
223
+
`default_width`: The default pixel width to use on image export.
224
+
225
+
`default_height`: The default pixel height to use on image export.
226
+
227
+
`default_scale`: The default image scale factor applied on image export.
228
+
229
+
`default_format`: The default image format used on export. One of "png", "jpeg", "webp", "svg", "pdf", or "eps" (Kaleido v1 only).
230
+
231
+
`mathjax`: Location of the MathJax bundle needed to render LaTeX characters. Defaults to a CDN location. If fully offline export is required, set this to a local MathJax bundle.
232
+
233
+
`topojson`: Location of the topojson files needed to render choropleth traces. Defaults to a CDN location. If fully offline export is required, set this to a local directory containing the Plotly.js topojson files.
234
+
235
+
`mapbox_access_token`: The default Mapbox access token.
236
+
237
+
### Configuring Defaults
238
+
239
+
Since Plotly.py 6.1, settings are available on `plotly.io.defaults`
240
+
241
+
To set the `default_format` to "jpeg":
242
+
243
+
~~~python
244
+
import plotly.io as pio
245
+
pio.defaults.default_format ="jpeg"
246
+
~~~
247
+
248
+
You can also access current defaults. To see the default value for height:
249
+
250
+
~~~python
251
+
import plotly.io as pio
252
+
pio.defaults.default_height
253
+
~~~
254
+
255
+
In earlier versions of Plotly.py, these settings are available on `plotly.io.kaleido.scope`. This is deprecated since version 6.1. Use `plotly.io.defaults` instead.
0 commit comments