Skip to content

Commit d43bca2

Browse files
committed
Improve line labels
1 parent 0ea23f1 commit d43bca2

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

examples/hello_world.jpg

438 Bytes
Loading

examples/hello_world.png

658 Bytes
Loading

examples/hello_world.roc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ config =
1111
width: 1024,
1212
height: 768,
1313
lines: [
14-
{ name: "sine", color: blue, points: sin },
1514
{ name: "cosine", color: green, points: cos },
16-
{ name: "sine2", color: red, points: sin2 },
17-
{ name: "cosine2", color: cyan, points: cos2 },
15+
{ name: "cosine x 2", color: cyan, points: cosX2 },
16+
{ name: "sine", color: blue, points: sin },
17+
{ name: "sine x 2", color: red, points: sinX2 },
1818
],
1919
}
2020

@@ -23,5 +23,5 @@ ok = \r -> Result.withDefault r 0
2323
domain = List.range -100 101 |> List.map (\i -> pi * (Num.toFloat i) / 100 |> ok)
2424
cos = domain |> List.map (\x -> P2 x (Num.cos x))
2525
sin = domain |> List.map (\x -> P2 x (Num.sin x))
26-
cos2 = domain |> List.map (\x -> P2 x (2 * Num.cos x))
27-
sin2 = domain |> List.map (\x -> P2 x (2 * Num.sin x))
26+
cosX2 = domain |> List.map (\x -> P2 x (2 * Num.cos x))
27+
sinX2 = domain |> List.map (\x -> P2 x (2 * Num.sin x))

examples/hello_world.svg

Lines changed: 15 additions & 15 deletions
Loading

platform/src/plot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn plot_with<Backend: DrawingBackend>(
5858
let v: Vec<(f64, f64)> = line.points.iter().map(|point| (point.x, point.y)).collect();
5959
let color = RGBColor(line.color.r, line.color.g, line.color.b);
6060
cc.draw_series(LineSeries::new(v, color))?
61-
.label(format!("Line {:?}", line.name))
61+
.label(line.name.as_str())
6262
.legend(move |(x, y)| PathElement::new(vec![(x, y), (x + 20, y)], color));
6363
}
6464
cc.configure_series_labels().border_style(&BLACK).draw()?;

0 commit comments

Comments
 (0)