use vega_lite_4::*; use rulinalg::matrix::Matrix; fn main() -> Result<(), Box> { // A new matrix with 4 rows and 2 columns. let values = Matrix::new(4, 2, (1..9).collect::>()); // the chart let chart = VegaliteBuilder::default() .title("Random points") .data(values) .mark(Mark::Point) .encoding( EdEncodingBuilder::default() .x(XClassBuilder::default() .field("0") .position_def_type(Type::Quantitative) .build()?) .y(YClassBuilder::default() .field("1") .position_def_type(Type::Quantitative) .build()?) .build()?, ) .build()?; // display the chart using `showata` chart.show()?; // print the vega lite spec eprint!("{}", chart.to_string()?); Ok(()) }