diff options
Diffstat (limited to 'examples/nested_coord.rs')
-rw-r--r-- | examples/nested_coord.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/nested_coord.rs b/examples/nested_coord.rs index 96f2e34..b700101 100644 --- a/examples/nested_coord.rs +++ b/examples/nested_coord.rs @@ -1,7 +1,7 @@ use plotters::prelude::*; +const OUT_FILE_NAME: &'static str = "plotters-doc-data/nested_coord.png"; fn main() -> Result<(), Box<dyn std::error::Error>> { - let root = - BitMapBackend::new("plotters-doc-data/nested_coord.png", (640, 480)).into_drawing_area(); + let root = BitMapBackend::new(OUT_FILE_NAME, (640, 480)).into_drawing_area(); root.fill(&WHITE)?; @@ -35,6 +35,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { &RED, ))?; + // To avoid the IO failure being ignored silently, we manually call the present function + root.present().expect("Unable to write result to file, please make sure 'plotters-doc-data' dir exists under current dir"); + println!("Result has been saved to {}", OUT_FILE_NAME); + Ok(()) } #[test] |