Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions examples/customization/consistent_static_format_export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,9 @@ This example demonstrates exporting a plot to SVG, PNG, and PDF using plotly.rs

This example is based on [GitHub Issue #171](https://github.com/plotly/plotly.rs/issues/171).


**Summary:**

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.

**Recommendation:**

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.

## Overview

This example creates a line and scatter plot with custom styling, including:
- Large font sizes for titles, legends, and axes
- Custom legend positioning and styling
- Border shapes around the plot
- Export to multiple formats (PDF, SVG, PNG)
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.

## Running the Example

Expand All @@ -29,6 +16,6 @@ cargo run
```

This will generate three output files:
- `Data_plot.pdf` - PDF format (typically renders correctly)
- `Data_plot.svg` - SVG format (may have font/legend issues)
- `Data_plot.png` - PNG format (typically renders correctly)
- `Data_plot.png`
- `Data_plot.svg` - will render fonts differently when compared with PNG if font family not fully specified
- `Data_plot.pdf` - uses SVG for PDF generation and will inherit the same issue as SVG
Loading