Description
MWE is given from excerpt within plot.rs
:
use plotly::common::Mode;
use plotly::{Layout, Plot, Scatter};
fn line_and_scatter_plot() {
let trace1 = Scatter::new(vec![1, 2, 3, 4], vec![10, 15, 13, 17])
.name("trace1")
.mode(Mode::Markers);
let trace2 = Scatter::new(vec![2, 3, 4, 5], vec![16, 5, 11, 9])
.name("trace2")
.mode(Mode::Lines);
let trace3 = Scatter::new(vec![1, 2, 3, 4], vec![12, 9, 15, 12])
.name("trace3");
let mut plot = Plot::new();
plot.add_trace(trace1);
plot.add_trace(trace2);
plot.add_trace(trace3);
let layout = Layout::new().title("<b>Line and Scatter Plot</b>".into());
plot.set_layout(layout);
# if false { // We don't actually want to try and display the plot in a browser when running a doctest.
plot.show();
# }
}
fn main() -> std::io::Result<()> {
line_and_scatter_plot();
Ok(())
}
Expected: Generated HTML to be opened using the user's default browser.
Actual: System exits with code 0, though no process is spawned/made apparent.
At a glance the issue here seems to be with the parameters used when attempting to open the browser and more specifically their formatting (possibly a quirk of using the older syntax affected by the now closed issue #29494 or alternatively, regarding how the output
method is being handled on Windows).
As an aside I'd imagine this probably went undetected for some time courtesy of:
"// We don't actually want to try and display the plot in a browser when running a doctest."
but this is just speculation and fortunately this can be hastily remedied and I'll open a PR for shortly.
Thanks! ❤️