rustplotlib icon indicating copy to clipboard operation
rustplotlib copied to clipboard

custom derive

Open ubnt-intrepid opened this issue 7 years ago • 0 comments


#[derive(Matplotlib)]
#[mpl(title="Sine curve", xlabel="Time[sec]", legend="upper right")]
struct PlotData {
  #[mpl(xaxis)]
  xdata: Vec<f64>,
  #[mpl(yaxis(label="sin(x)"))]
  ydata1: Vec<f64>,
  #[mpl(yaxis(label="cos(x)"))]
  ydata2: Vec<f64>,
}

fn main() {
  let plot_data = PlotData::new();
  let fig = plot_data.to_fig();
  ...
}

ubnt-intrepid avatar Apr 09 '17 10:04 ubnt-intrepid