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: examples/customization/consistent_static_format_export/README.md
+4-17Lines changed: 4 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -4,22 +4,9 @@ This example demonstrates exporting a plot to SVG, PNG, and PDF using plotly.rs
4
4
5
5
This example is based on [GitHub Issue #171](https://github.com/plotly/plotly.rs/issues/171).
6
6
7
-
8
-
**Summary:**
9
-
10
7
For consistent font rendering across browsers and export formats, always set the `font.family` property explicitly in your plot configuration. Relying on default or generic font settings can lead to differences in appearance, especially for font size and legend layout, depending on the browser or export backend.
11
8
12
-
**Recommendation:**
13
-
14
-
Always set the `font.family` property (e.g., to `"Times New Roman, serif"`) for all text elements (titles, axes, legends) to ensure consistent results in all output formats.
15
-
16
-
## Overview
17
-
18
-
This example creates a line and scatter plot with custom styling, including:
19
-
- Large font sizes for titles, legends, and axes
20
-
- Custom legend positioning and styling
21
-
- Border shapes around the plot
22
-
- Export to multiple formats (PDF, SVG, PNG)
9
+
The issue reported in [#171](https://github.com/plotly/plotly.rs/issues/171)is solved when the `font.family` property is set explicitly (e.g., to `"Times New Roman, serif"`) for all text elements (titles, axes, legends) which ensures consistent results in all output formats accross different browsers.
23
10
24
11
## Running the Example
25
12
@@ -29,6 +16,6 @@ cargo run
29
16
```
30
17
31
18
This will generate three output files:
32
-
-`Data_plot.pdf` - PDF format (typically renders correctly)
33
-
-`Data_plot.svg` - SVG format (may have font/legend issues)
34
-
-`Data_plot.png` - PNG format (typically renders correctly)
19
+
-`Data_plot.png`
20
+
-`Data_plot.svg` - will render fonts differently when compared with PNG if font family not fully specified
21
+
-`Data_plot.pdf` - uses SVG for PDF generation and will inherit the same issue as SVG
0 commit comments