We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Jupyter doesn't display the plot properly if the data that goes into the LineSeries is borrowed.
To Reproduce
:dep plotters = { version = "^0.3.5", default_features = false, features = ["evcxr", "all_series", "all_elements"] } use plotters::prelude::*; let points: Vec<(f64, f64)> = (0..1000).map(|i| i as f64).map(|i| (i, (i * 0.1).cos())).collect(); evcxr_figure((640, 240), |root| { root.fill(&WHITE)?; let min_x = points.iter().map(|(x, _)| x).min_by(|a, b| a.partial_cmp(b).unwrap()).copied().unwrap(); let max_x = points.iter().map(|(x, _)| x).max_by(|a, b| a.partial_cmp(b).unwrap()).copied().unwrap(); let min_y = points.iter().map(|(_, y)| y).min_by(|a, b| a.partial_cmp(b).unwrap()).copied().unwrap(); let max_y = points.iter().map(|(_, y)| y).max_by(|a, b| a.partial_cmp(b).unwrap()).copied().unwrap(); let mut chart = ChartBuilder::on(&root) .margin(5) //.caption("BTC Price", ("sans-serif", 20)) .x_label_area_size(30) .y_label_area_size(30) .build_cartesian_2d(min_x..max_x, min_y..max_y)?; chart.configure_mesh().draw()?; chart.draw_series(LineSeries::new( points.clone(), &RED, ))?; Ok(()) })
This shows the correct plot.
But, if I remove the .clone() when creating the line series the plot is gone and I see only raw HTML / SVG.
.clone()
EVCXR_END_CONTENT EVCXR_BEGIN_CONTENT text/html <div style=""><svg width="640" height="240" viewBox="0 0 640 240" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="640" height="240" opacity="1" fill="#FFFFFF" stroke="none"/> <line opacity="0.1" stroke="#000000" stroke-width="1" x1="35" y1="204" x2="35" y2="5"/> <line opacity="0.1" stroke="#000000" stroke-width="1" x1="40" y1="204" x2="40" y2="5"/> <line opacity="0.1" stroke="#000000" stroke-width="1" x1="46" y1="204" x2="46" y2="5"/> <line opacity="0.1" stroke="#000000" stroke-width="1" x1="52" y1="204" x2="52" y2="5"/> <line opacity="0.1" stroke="#000000" stroke-width="1" x1="58" y1="204" x2="58" y2="5"/> <line opacity="0.1" stroke="#000000" stroke-width="1" x1="64" y1="204" x2="64" y2="5"/> <line opacity="0.1" stroke="#000000" stroke-width="1" x1="70" y1="204" x2="70" y2="5"/> <line opacity="0.1" stroke="#000000" stroke-width="1" x1="76" y1="204" x2="76" y2="5"/> <line opacity="0.1" stroke="#000000" stroke-width="1" x1="82" y1="204" x2="82" y2="5"/> <line opacity="0.1" stroke="#000000" stroke-width="1" x1="88" y1="204" x2="88" y2="5"/> ...
Why is that?
Version Information ^0.3.5
^0.3.5
Cross posted here.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Jupyter doesn't display the plot properly if the data that goes into the LineSeries is borrowed.
To Reproduce
This shows the correct plot.
But, if I remove the
.clone()
when creating the line series the plot is gone and I see only raw HTML / SVG.Why is that?
Version Information
^0.3.5
Cross posted here.
The text was updated successfully, but these errors were encountered: