Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Uneven mesh spacing #275

Open
Tracked by #380
EFanZh opened this issue Aug 1, 2021 · 0 comments
Open
Tracked by #380

[BUG] Uneven mesh spacing #275

EFanZh opened this issue Aug 1, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@EFanZh
Copy link

EFanZh commented Aug 1, 2021

Describe the bug

I noticed uneven mesh spacing when I uses date values as X values:

mesh

Notice the spaces between vertical lines are not always the same.

To Reproduce

use chrono::{TimeZone, Utc};
use plotters::chart::ChartBuilder;
use plotters::drawing::IntoDrawingArea;
use plotters::prelude::SVGBackend;
use std::error::Error;
use std::fs::File;
use std::io::Write;

fn main() -> Result<(), Box<dyn Error>> {
    let mut svg = String::new();

    ChartBuilder::on(&SVGBackend::with_string(&mut svg, (1000, 600)).into_drawing_area())
        .build_cartesian_2d(Utc.ymd(2018, 2, 1)..Utc.ymd(2021, 8, 1), 0..100)?
        .configure_mesh()
        .x_labels(10)
        .y_labels(10)
        .draw()?;

    File::create("output.svg")
        .unwrap()
        .write_all(svg.as_bytes())
        .map_err(Into::into)
}

Version Information

I am using plotters 0.3.1.

@EFanZh EFanZh added the bug Something isn't working label Aug 1, 2021
@EFanZh EFanZh changed the title [BUG] Strange mesh spacing [BUG] Uneven mesh spacing Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant