Skip to content

Commit 3e898d7

Browse files
committed
Add a buffer to the axes in a scatter plot
1 parent 8e891c9 commit 3e898d7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/scatter.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ impl Scatter {
2525
data.push((x, y));
2626
}
2727

28+
let x_range = x_max - x_min;
29+
let y_range = y_max - y_min;
30+
x_min = x_min - (x_range/20.0);
31+
x_max = x_max + (x_range/20.0);
32+
y_min = y_min - (y_range/20.0);
33+
y_max = y_max + (y_range/20.0);
34+
2835
let x_axis = axis::Axis::new(x_min, x_max);
2936
let y_axis = axis::Axis::new(y_min, y_max);
3037

0 commit comments

Comments
 (0)