Skip to content

Commit

Permalink
Generate and keep in the repo the missing image in the README
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
Chris00 committed Feb 28, 2024
1 parent df29d8e commit 33d7e99
Show file tree
Hide file tree
Showing 4 changed files with 462 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion examples/a_simple_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ fn main() -> Result<(), Box<dyn Error>> {
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(())
}
10 changes: 10 additions & 0 deletions examples/basic_example.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Example for the README

use matplotlib as plt;

fn main() -> Result<(), Box<dyn std::error::Error>> {
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(())
}
Loading

0 comments on commit 33d7e99

Please sign in to comment.