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
{{ message }}
Repository navigation
Commit 51df28b
Browse filesBrowse the repository at this point in the historyBrowse files
<code>toImage</code> will generate a promise to an image of the plot in data URL format.
605
+
606
+
<code>format</code> takes one of <code>png</code>, <code>jpeg</code>, <code>webp</code>, <code>svg</code>, or <code>full-json</code>. The default is <code>png</code>.
607
+
<code>full-json</code> returns the figure as JSON instead of a rendered image. The JSON holds the data, layout, frames, and config, with every default value filled in.
608
+
Set <code>imageDataOnly</code> to <code>true</code> to get the raw JSON string rather than a <code>data:application/json</code> URL.
To view this image in your page include following HTML tag:
45
32
46
-
<img id="jpg-export"></img>
33
+
<img id="jpg-export">
47
34
48
35
Height and width of the image can be adjusted by specifying the same in `toImage` call:
49
36
50
-
Plotly.toImage(
51
-
gd,{
52
-
format:'jpeg',
53
-
height:desired_height,
54
-
width:desired_width,
37
+
Plotly.toImage(gd, {
38
+
format: 'jpeg',
39
+
height: desiredHeight,
40
+
width: desiredWidth
55
41
});
56
42
57
43
You can also save the image using different formats.
58
44
59
45
# Formats Supported
60
46
61
-
The common image formats: 'PNG', 'JPG/JPEG' are supported. In addition, formats like 'EPS', 'SVG' and 'PDF' are also available for user with a Personal or Professional subscription. You can get more details on our [pricing page] (https://plotly.com/products/cloud/)
47
+
`Plotly.toImage`and `Plotly.downloadImage` take one of five values for `format`:
62
48
63
-
**Note:** It is important to note that any figures containing WebGL traces (i.e. of type scattergl, scatter3d, surface, mesh3d, scatterpolargl, cone, streamtube, splom, or parcoords) that are exported in a vector format like SVG or PDF will include encapsulated rasters instead of vectors for some parts of the image.
49
+
-`png` - raster image, and the default format
50
+
-`jpeg` - raster image with no transparency
51
+
-`webp` - raster image
52
+
-`svg` - vector image
53
+
-`full-json` - the figure specification as JSON, not a rendered image
54
+
55
+
**Note:** A figure that contains a WebGL trace (of type scattergl, scatter3d, surface, mesh3d, scatterpolargl, cone, streamtube, splom, or parcoords) holds encapsulated rasters instead of vectors for some parts of an SVG export.
0 commit comments