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

First code example doesn't compile #3

Open
Rik-de-Kort opened this issue Feb 15, 2020 · 1 comment
Open

First code example doesn't compile #3

Rik-de-Kort opened this issue Feb 15, 2020 · 1 comment

Comments

@Rik-de-Kort
Copy link

Rik-de-Kort commented Feb 15, 2020

Working on Ubuntu Eoan. Unsure what to do as I am very new to Rust.

Code

use plotters::prelude::*;

fn main() {
    let root_drawing_area = BitMapBackend::new("result.png", (1024, 768))
        .into_drawing_area();

    root_drawing_area.fill(&WHITE);

    let chart = ChartBuilder::on(&root_drawing_area)
        .build_ranged(-3.14..3.14, -1.2..1.2)
        .unwrap();

    chart.draw(LineSeries::new(
        (-314..314).map(|x| x as f64 / 100.0).map(|x| (x, x.sin())),
        &RED
    )).unwrap();
}

yields error:

   Compiling mcmc v0.1.0 (/home/rik/mcmc)
error[E0599]: no method named `draw` found for type `plotters::chart::context::ChartContext<'_, plotters::drawing::backend_impl::bitmap::BitMapBackend<'_>, plotters::coord::ranged::RangedCoord<_, _>>` in the current scope
  --> src/main.rs:16:11
   |
16 |     chart.draw(LineSeries::new(
   |           ^^^^ method not found in `plotters::chart::context::ChartContext<'_, plotters::drawing::backend_impl::bitmap::BitMapBackend<'_>, plotters::coord::ranged::RangedCoord<_, _>>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: could not compile `mcmc`.

To learn more, run the command again with --verbose.

shell returned 101
@38
Copy link
Member

38 commented Feb 15, 2020

Hi, you should use draw_series rather than draw. Please let me know if it's still broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants