Skip to content

Commit 1df31e3

Browse files
committed
Docs for group_by
1 parent ebb8c22 commit 1df31e3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/coord/group_by.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ use std::ops::Range;
66
/// This is useful, for example, when we have an X axis is a integer and denotes days.
77
/// And we are expecting the tick mark denotes weeks, in this way we can make the range
88
/// spec grouping by 7 elements.
9+
/// With the help of the GroupBy decorator, this can be archived quite easily:
10+
///```rust
11+
///use plotters::prelude::*;
12+
///let mut buf = vec![0;1024*768*3];
13+
///let area = BitMapBackend::with_buffer(buf.as_mut(), (1024, 768)).into_drawing_area();
14+
///let chart = ChartBuilder::on(&area)
15+
/// .build_ranged((0..100).group_by(7), 0..100)
16+
/// .unwrap();
17+
///```
918
#[derive(Clone)]
1019
pub struct GroupBy<T: DiscreteRanged>(T, usize);
1120

src/data/float.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// The code that is related to float number handling
2-
32
fn find_minimal_repr(n: f64, eps: f64) -> (f64, usize) {
43
if eps >= 1.0 {
54
return (n, 0);

0 commit comments

Comments
 (0)