You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a feature request for supporting a animated plot like seen in this python example.
I would expect it to work by giving for x and y a slice of slices or a slice of Vecs instead of a single slice.
Given this python example:
A usage example could look like the following code:
use plotly::{common::Mode,Plot,Scatter};
fn main() -> Result<(),BoxErr> {
// Four different time points
let time = vec![1.0,2.0,3.0,4.0];
// For each timepoint generate data. This could be a position for example.
let mut x = Vec::with_capacity(time.len());
for i in 0..time.len() {
x.push((0..1_000).map(|x|x as f64*0.1).collect::<Vec<f64>>());
}
// For each timepoint evaluate some function at each position
let mut y = Vec::with_capacity(time.len());
for (i,xi) in x.iter().enumerate() {
y.push(
xi.iter().map(|xk| xk*xk + time[i]).collect::<Vec<f64>>()
);
}
// Generate traces from the data
let traces = x.into_iter().zip(y).map(|(x,y)| Scatter::new(x,y).mode(Mode::Lines)).collect::<Vec<_>>();
// Plot the data and animate the plot with respect to time
let mut plot = Plot::new();
plot.add_traces(traces).animate_by(time);
plot.show();
Ok(())
}
The text was updated successfully, but these errors were encountered:
This is a feature request for supporting a animated plot like seen in this python example.
I would expect it to work by giving for x and y a slice of slices or a slice of Vecs instead of a single slice.
Given this python example:
A usage example could look like the following code:
The text was updated successfully, but these errors were encountered: