Skip to content

Commit e09475b

Browse files
authored
re-generate README.md (#371)
1 parent a4744f3 commit e09475b

File tree

2 files changed

+47
-33
lines changed

2 files changed

+47
-33
lines changed

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,16 @@ Here is a list of the main high-level functions for common scenarios:
6161
```
6262
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot3.png" width="450"><br>
6363

64-
These mutating methods cannot update the limits of the axes (xlims & ylims) as plots are drawn onto a fixed canvas. The limits must be set by the plotting function that creates the figure or by creating an empty `Plot`:
64+
65+
These mutating methods cannot update the limits of the axes as plots are drawn onto a fixed canvas. The limits must be set beforehand by the plotting function that creates the figure or by creating an empty `Plot`:
66+
6567
```julia
6668
p = Plot(; xlim=(-1, 3), ylim=(-1, 3))
6769
lineplot!(p, 1:2)
70+
```
71+
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot4.png" width="450"><br>
6872

73+
6974
One can adjust the plot `height` and `width` to the current terminal size by using `height=:auto` and/or `width=:auto`.
7075

7176
You can reverse/flip the `Plot` axes by setting `xflip=true` and/or `yflip=true` on plot creation.
@@ -78,31 +83,31 @@ Here is a list of the main high-level functions for common scenarios:
7883
```julia
7984
lineplot([1, 2, 7], [9, -6, 8], title="My Lineplot")
8085
```
81-
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot4.png" width="450"><br>
86+
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot5.png" width="450"><br>
8287

8388

8489
It's also possible to specify a function and a range:
8590

8691
```julia
8792
plt = lineplot(-π/2, 2π, [cos, sin])
8893
```
89-
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot5.png" width="450"><br>
94+
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot6.png" width="450"><br>
9095

9196

9297
You can also plot lines by specifying an intercept and slope:
9398

9499
```julia
95100
lineplot!(plt, -.5, .2, name="line")
96101
```
97-
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot6.png" width="450"><br>
102+
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot7.png" width="450"><br>
98103

99104

100105
Plotting multiple series is supported by providing a `Matrix` (`<: AbstractMatrix`) for the `y` argument, with the individual series corresponding to its columns. Auto-labeling is by default, but you can also label each series by providing a `Vector` or a `1xn` `Matrix` such as `["series 1" "series2" ...]`:
101106

102107
```julia
103108
lineplot(1:10, [0:9 3:12 reverse(5:14) fill(4, 10)], color=[:green :red :yellow :cyan])
104109
```
105-
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot7.png" width="450"><br>
110+
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot8.png" width="450"><br>
106111

107112

108113
Physical quantities of [`Unitful.jl`](https://github.com/PainterQubits/Unitful.jl) are supported through [package extensions - weak dependencies](https://pkgdocs.julialang.org/dev/creating-packages/#Conditional-loading-of-code-in-packages-(Extensions)):
@@ -112,7 +117,7 @@ Here is a list of the main high-level functions for common scenarios:
112117
a, t = 1u"m/s^2", (0:100) * u"s"
113118
lineplot(a / 2 * t .^ 2, a * t, xlabel="position", ylabel="speed", height=10)
114119
```
115-
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot8.png" width="450"><br>
120+
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot9.png" width="450"><br>
116121

117122

118123
Intervals from [`IntervalSets.jl`](https://github.com/JuliaMath/IntervalSets.jl) are supported:
@@ -121,15 +126,15 @@ Here is a list of the main high-level functions for common scenarios:
121126
using IntervalSets
122127
lineplot(-1..3, x -> x^5 - 5x^4 + 5x^3 + 5x^2 - 6x - 1; name="quintic")
123128
```
124-
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot9.png" width="450"><br>
129+
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot10.png" width="450"><br>
125130

126131

127132
Use `head_tail` to mimic plotting arrows (`:head`, `:tail` or `:both`) where the length of the "arrow" head or tail is controlled using `head_tail_frac` where e.g. giving a value of `0.1` means `10%` of the segment length:
128133

129134
```julia
130135
lineplot(1:10, 1:10, head_tail=:head, head_tail_frac=.1, height=4)
131136
```
132-
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot10.png" width="450"><br>
137+
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot11.png" width="450"><br>
133138

134139

135140
`UnicodePlots` exports `hline!` and `vline!` for drawing vertical and horizontal lines on a plot:
@@ -141,7 +146,7 @@ Here is a list of the main high-level functions for common scenarios:
141146
hline!(p, 7, color=:cyan)
142147
vline!(p, 1, color=:yellow)
143148
```
144-
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot11.png" width="450"><br>
149+
<img src="https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs/3.x/lineplot12.png" width="450"><br>
145150

146151

147152
</details>
@@ -623,7 +628,7 @@ The method `label!` is responsible for the setting all the textual decorations o
623628
- `thousands_separator::Char = ' '`: thousands separator character (use `Char(0)` to disable grouping digits).
624629
- `projection::Symbol = :orthographic`: projection for 3D plots (`:ortho(graphic)`, `:persp(ective)`, or `Model-View-Projection` (MVP) matrix).
625630
- `axes3d::Bool = true`: draw 3d axes (`x -> :red`, `y -> :green`, `z -> :blue`).
626-
- `elevation::Float = 35.26`: elevation angle above or below the `floor` plane (`-90 ≤ θ ≤ 90`).
631+
- `elevation::Float = 35.264389682754654`: elevation angle above or below the `floor` plane (`-90 ≤ θ ≤ 90`).
627632
- `azimuth::Float = 45.0`: azimutal angle around the `up` vector (`-180° ≤ φ ≤ 180°`).
628633
- `zoom::Float = 1.0`: zooming factor in 3D.
629634
- `up::Symbol = :z`: up vector (`:x`, `:y` or `:z`), prefix with `m -> -` or `p -> +` to change the sign e.g. `:mz` for `-z` axis pointing upwards.

docs/gen_docs.jl

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,38 @@ main() = begin
1818
xlabel="x", ylabel="y", canvas=DotCanvas, border=:ascii)
1919
"""),
2020
lineplot3 = ("Basic Canvas", "lineplot!(plt, [0, 4, 8], [10, 1, 10], color=:cyan, name=\"other line\")"),
21-
scatterplot1 = ("Scatterplot", "scatterplot(randn(50), randn(50), title=\"My Scatterplot\")"),
22-
scatterplot2 = ("Scatterplot", "scatterplot(1:10, 1:10, xscale=:log10, yscale=:log10)"),
23-
scatterplot3 = ("Scatterplot", "scatterplot(1:4, 1:4, xscale=:log10, yscale=:ln, unicode_exponent=false, height=6)"),
24-
scatterplot4 = ("Scatterplot", """
25-
scatterplot([1, 2, 3], [3, 4, 1], marker=[:circle, '', "∫"],
26-
color=[:cyan, nothing, :yellow], height=2)
21+
lineplot4 = ("Basic Canvas", """
22+
p = Plot(; xlim=(-1, 3), ylim=(-1, 3))
23+
lineplot!(p, 1:2)
2724
"""),
28-
lineplot4 = ("Lineplot", "lineplot([1, 2, 7], [9, -6, 8], title=\"My Lineplot\")"),
29-
lineplot5 = ("Lineplot", "plt = lineplot(-π/2, 2π, [cos, sin])"),
30-
lineplot6 = ("Lineplot", "lineplot!(plt, -.5, .2, name=\"line\")"),
31-
lineplot7 = ("Lineplot", "lineplot(1:10, [0:9 3:12 reverse(5:14) fill(4, 10)], color=[:green :red :yellow :cyan])"),
32-
lineplot8 = ("Lineplot", """
25+
lineplot5 = ("Lineplot", "lineplot([1, 2, 7], [9, -6, 8], title=\"My Lineplot\")"),
26+
lineplot6 = ("Lineplot", "plt = lineplot(-π/2, 2π, [cos, sin])"),
27+
lineplot7 = ("Lineplot", "lineplot!(plt, -.5, .2, name=\"line\")"),
28+
lineplot8 = ("Lineplot", "lineplot(1:10, [0:9 3:12 reverse(5:14) fill(4, 10)], color=[:green :red :yellow :cyan])"),
29+
lineplot9 = ("Lineplot", """
3330
using Unitful
3431
a, t = 1u"m/s^2", (0:100) * u"s"
3532
lineplot(a / 2 * t .^ 2, a * t, xlabel="position", ylabel="speed", height=10)
3633
"""),
37-
lineplot9 = ("Lineplot", """
34+
lineplot10 = ("Lineplot", """
3835
using IntervalSets
3936
lineplot(-1..3, x -> x^5 - 5x^4 + 5x^3 + 5x^2 - 6x - 1; name="quintic")
4037
"""),
41-
lineplot10 = ("Lineplot", "lineplot(1:10, 1:10, head_tail=:head, head_tail_frac=.1, height=4)"),
42-
lineplot11 = ("Lineplot", """
38+
lineplot11 = ("Lineplot", "lineplot(1:10, 1:10, head_tail=:head, head_tail_frac=.1, height=4)"),
39+
lineplot12 = ("Lineplot", """
4340
p = Plot([NaN], [NaN]; xlim=(0, 8), ylim=(0, 8))
4441
vline!(p, [2, 6], [2, 6], color=:red)
4542
hline!(p, [2, 6], [2, 6], color=:white)
4643
hline!(p, 7, color=:cyan)
4744
vline!(p, 1, color=:yellow)
4845
"""),
46+
scatterplot1 = ("Scatterplot", "scatterplot(randn(50), randn(50), title=\"My Scatterplot\")"),
47+
scatterplot2 = ("Scatterplot", "scatterplot(1:10, 1:10, xscale=:log10, yscale=:log10)"),
48+
scatterplot3 = ("Scatterplot", "scatterplot(1:4, 1:4, xscale=:log10, yscale=:ln, unicode_exponent=false, height=6)"),
49+
scatterplot4 = ("Scatterplot", """
50+
scatterplot([1, 2, 3], [3, 4, 1], marker=[:circle, '', "∫"],
51+
color=[:cyan, nothing, :yellow], height=2)
52+
"""),
4953
stairs1 = ("Staircase", """
5054
stairs([1, 2, 4, 7, 8], [1, 3, 4, 2, 7],
5155
color=:yellow, style=:post, height=6, title="Staircase")
@@ -367,6 +371,10 @@ $(indent(examples.lineplot2))
367371
368372
$(indent(examples.lineplot3))
369373
374+
These mutating methods cannot update the limits of the axes as plots are drawn onto a fixed canvas. The limits must be set beforehand by the plotting function that creates the figure or by creating an empty `Plot`:
375+
376+
$(indent(examples.lineplot4))
377+
370378
One can adjust the plot `height` and `width` to the current terminal size by using `height=:auto` and/or `width=:auto`.
371379
372380
You can reverse/flip the `Plot` axes by setting `xflip=true` and/or `yflip=true` on plot creation.
@@ -376,35 +384,35 @@ $(indent(examples.lineplot3))
376384
<details open>
377385
$(summary("Lineplot"))
378386
379-
$(indent(examples.lineplot4))
387+
$(indent(examples.lineplot5))
380388
381389
It's also possible to specify a function and a range:
382390
383-
$(indent(examples.lineplot5))
391+
$(indent(examples.lineplot6))
384392
385393
You can also plot lines by specifying an intercept and slope:
386394
387-
$(indent(examples.lineplot6))
395+
$(indent(examples.lineplot7))
388396
389397
Plotting multiple series is supported by providing a `Matrix` (`<: AbstractMatrix`) for the `y` argument, with the individual series corresponding to its columns. Auto-labeling is by default, but you can also label each series by providing a `Vector` or a `1xn` `Matrix` such as `["series 1" "series2" ...]`:
390398
391-
$(indent(examples.lineplot7))
399+
$(indent(examples.lineplot8))
392400
393401
Physical quantities of [`Unitful.jl`](https://github.com/PainterQubits/Unitful.jl) are supported through [package extensions - weak dependencies](https://pkgdocs.julialang.org/dev/creating-packages/#Conditional-loading-of-code-in-packages-(Extensions)):
394402
395-
$(indent(examples.lineplot8))
403+
$(indent(examples.lineplot9))
396404
397405
Intervals from [`IntervalSets.jl`](https://github.com/JuliaMath/IntervalSets.jl) are supported:
398406
399-
$(indent(examples.lineplot9))
407+
$(indent(examples.lineplot10))
400408
401409
Use `head_tail` to mimic plotting arrows (`:head`, `:tail` or `:both`) where the length of the "arrow" head or tail is controlled using `head_tail_frac` where e.g. giving a value of `0.1` means `10%` of the segment length:
402410
403-
$(indent(examples.lineplot10))
411+
$(indent(examples.lineplot11))
404412
405413
`UnicodePlots` exports `hline!` and `vline!` for drawing vertical and horizontal lines on a plot:
406414
407-
$(indent(examples.lineplot11))
415+
$(indent(examples.lineplot12))
408416
409417
</details>
410418
@@ -738,13 +746,14 @@ Inspired by [TextPlots.jl](https://github.com/sunetos/TextPlots.jl), which in tu
738746
if true
739747
cursor_hide(stdout)
740748
run(`clear`)
741-
print(stdout, g)
749+
println(stdout, g)
742750
win = if "WINDOWID" ∈ keys(ENV)
743751
ENV["WINDOWID"]
744752
else
745753
readchomp(`xdotool getactivewindow`)
746754
end
747755
tmp = tempname()
756+
sleep(1)
748757
# XX%x100% => remove the right scrollbar (run in a big terminal window)
749758
run(`import -window \$win -gravity West -crop 70%x100%+0+0 -trim -quality 100 \$tmp.miff`)
750759
# FIXME: export to `jpg` format, since we have an issue with rendering this `png` on github

0 commit comments

Comments
 (0)