Skip to content

Line plot with 3 data points creates huge SVG file (920 MB) #80

@venkat0791

Description

@venkat0791

Describe the bug
A simple line plot with 3 data points produces a huge (920 MB!) SVG file, which I can't even open. See code below. This must have something to do with the y-values being very small, because scaling them all up by 1e14 produces a normal-sized SVG file (3.1 kB), as expected.

To reproduce

use kuva::prelude::*;

let plots = vec![LinePlot::new()
    .with_data(vec![(0.0, 1.0e-14), (0.5, 2.0e-14), (1.0, 1.5e-14)])
    .into()
];
let layout = Layout::auto_from_plots(&plots)
    .with_title("My Plot")
    .with_x_label("X")
    .with_y_label("Y");
let svg = render_to_svg(plots, layout);
std::fs::write("my_plot.svg", svg).unwrap();

Environment

  • kuva version: 0.2.0
  • Rust version (rustc --version): 1.91.0
  • OS: Linux Mint 22.3

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions