diff --git a/README.md b/README.md index aa3e06d..e1bbcf1 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ fig.savefig("plot.pdf")?; ``` -![Basic Example](https://matplotlib.org/stable/_images/sphx_glr_quick_start_001_2_0x.png) +![Basic Example](examples/basic_example.svg) [Matplotlib]: https://matplotlib.org/ diff --git a/examples/a_simple_example.rs b/examples/a_simple_example.rs index c4f900b..abb302f 100644 --- a/examples/a_simple_example.rs +++ b/examples/a_simple_example.rs @@ -9,6 +9,6 @@ fn main() -> Result<(), Box> { let y: Vec<_> = x.iter().map(|x| x.sin()).collect(); ax.xy(&x, &y).fmt("r.").plot(); // plt::show(); - fig.save().to_file("examples/a_simple_example.svg")?; + fig.save().to_file("target/a_simple_example.svg")?; Ok(()) } diff --git a/examples/basic_example.rs b/examples/basic_example.rs new file mode 100644 index 0000000..0cdfc3a --- /dev/null +++ b/examples/basic_example.rs @@ -0,0 +1,10 @@ +// Example for the README + +use matplotlib as plt; + +fn main() -> Result<(), Box> { + let (fig, [[mut ax]]) = plt::subplots()?; + ax.xy(&[1., 2., 3., 4.], &[1., 4., 2., 3.]).plot(); + fig.save().to_file("examples/basic_example.svg")?; + Ok(()) +} diff --git a/examples/basic_example.svg b/examples/basic_example.svg new file mode 100644 index 0000000..f979630 --- /dev/null +++ b/examples/basic_example.svg @@ -0,0 +1,450 @@ + + + + + + + + 2024-02-28T20:50:42.579048 + image/svg+xml + + + Matplotlib v3.6.3, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +