Skip to content

Commit 5d2f78c

Browse files
committed
Update examples in README.md
1 parent 3658fd7 commit 5d2f78c

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ y_sin = x.map {|xi| Math.sin(xi) }
1818
y_cos = x.map {|xi| Math.cos(xi) }
1919
plot = UnicodePlot.lineplot(x, y_sin, name: "sin(x)", width: 40, height: 10)
2020
UnicodePlot.lineplot!(plot, x, y_cos, name: "cos(x)")
21-
plot.render($stdout)
22-
puts
21+
plot.render
2322
```
2423

2524
You can get the results below by running the above script:
@@ -31,17 +30,15 @@ You can get the results below by running the above script:
3130
### barplot
3231

3332
```ruby
34-
plot = UnicodePlot.barplot(data: {'foo': 20, 'bar': 50}, title: "Bar")
35-
plot.render($stdout)
33+
UnicodePlot.barplot(data: {'foo': 20, 'bar': 50}, title: "Bar").render
3634
```
3735

3836
<img src="img/barplot.png" width="50%" />
3937

4038
### boxplot
4139

4240
```ruby
43-
plot = UnicodePlot.boxplot(data: {foo: [1, 3, 5], bar: [3, 5, 7]}, title: "Box")
44-
plot.render($stdout)
41+
UnicodePlot.boxplot(data: {foo: [1, 3, 5], bar: [3, 5, 7]}, title: "Box").render
4542
```
4643

4744
<img src="img/boxplot.png" width="50%" />
@@ -51,8 +48,7 @@ plot.render($stdout)
5148
```ruby
5249
x = Array.new(500) { 20*rand - 10 } + Array.new(500) { 6*rand - 3 }
5350
y = Array.new(1000) { 30*rand - 10 }
54-
plot = UnicodePlot.densityplot(x, y, title: "Density")
55-
plot.render($stdout)
51+
UnicodePlot.densityplot(x, y, title: "Density").render
5652
```
5753

5854
<img src="img/densityplot.png" width="50%" />
@@ -61,8 +57,7 @@ plot.render($stdout)
6157

6258
```ruby
6359
x = Array.new(100) { rand(10) } + Array.new(100) { rand(30) + 10 }
64-
plot = UnicodePlot.histogram(x, title: "Histogram")
65-
plot.render($stdout)
60+
UnicodePlot.histogram(x, title: "Histogram").render
6661
```
6762

6863
<img src="img/histogram.png" width="50%" />
@@ -76,8 +71,7 @@ See [Usage](#usage) section above.
7671
```ruby
7772
x = Array.new(50) { rand(20) - 10 }
7873
y = x.map {|xx| xx*rand(30) - 10 }
79-
plot = UnicodePlot.scatterplot(x, y, title: "Scatter")
80-
plot.render($stdout)
74+
UnicodePlot.scatterplot(x, y, title: "Scatter").render
8175
```
8276

8377
<img src="img/scatterplot.png" width="50%" />

0 commit comments

Comments
 (0)