tiby312 / poloto-project

MIT License
158 stars 10 forks source link

[Question] Manually set y bounds #211

Closed RouHim closed 1 year ago

RouHim commented 1 year ago

Hey, thanks for the great project! Is there a way to set / overwrite the data bounds for the y axis manually? Greetings.

tiby312 commented 1 year ago

Yes use poloto:build:markers() like below. The view will zoom out to fit the values you pass in.

use poloto::build::PlotRes;
    use poloto::build::PlotTag;

    let v: Vec<PlotRes<std::iter::Empty<PlotTag<(i128, i128), &'static str>>, (i128, i128)>> =
        vec![];

    let data = poloto::frame_build()
        .data(poloto::plots!(v, poloto::build::markers([], [5])))
        .build_and_label((
            "Some Trigonometry Plots 🥳",
            format_move!("This is the {} label", 'x'),
            "This is the y label",
        ));

    data.append_to(poloto::header().light_theme())
        .render_string()
RouHim commented 1 year ago

Thank you very much, that worked! It might be useful for others to add a piece of documentation or an example to the examples.

tiby312 commented 1 year ago

Absolutely i keep putting it off sorry about that