-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add polygons to draw filled polygons
- Loading branch information
1 parent
bcb592a
commit 9e23cb1
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// This file is released into Public Domain. | ||
use crate::common::*; | ||
use gnuplot::*; | ||
|
||
mod common; | ||
|
||
fn example(c: Common) | ||
{ | ||
let coords = [[0., 0.], [2., 0.], [3., 3.], [4., 4.], [-1., 3.], [0., 0.]]; | ||
|
||
let mut fg = Figure::new(); | ||
|
||
let ax = fg.axes2d(); | ||
ax.polygons( | ||
coords.iter().map(|x| x[0]), | ||
coords.iter().map(|x| x[1]), | ||
&[], | ||
); | ||
ax.lines( | ||
coords.iter().map(|x| x[0]), | ||
coords.iter().map(|x| x[1]), | ||
&[], | ||
); | ||
|
||
c.show(&mut fg, "polygons"); | ||
} | ||
|
||
fn main() | ||
{ | ||
Common::new().map(|c| example(c)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters