Add doctest of dumb terminal
This serves two purposes: 1. It demonstrates the functionality of the dumb terminal. 2. It checks that the previous commit works.
This commit is contained in:
parent
d02c211e99
commit
799154f53c
@ -28,7 +28,31 @@ Press the `h` key on the window to display an help message with all available ke
|
||||
## Plot in a terminal application (`dumb`, `sixel` and `sixelgd`)
|
||||
Gnuplot supports plotting in a terminal application, with no need for X11 or other GUI support, via the `dumb`, `sixel` and `sixelgd` terminals. These are extremely useful when you run Julia on a remote shell through `ssh`, with no X11 forwarding.
|
||||
|
||||
The `dumb` terminal uses ASCII characters to draw a plot, while `sixel` and `sixelgd` actually use bitmaps (but require Sixel support to be enabled in the terminal, e.g. `xterm -ti vt340`). A sixel plot on `xterm` looks as follows:
|
||||
The `dumb` terminal uses ASCII characters to draw a plot, while `sixel` and `sixelgd` actually use bitmaps (but require Sixel support to be enabled in the terminal, e.g. `xterm -ti vt340`). Dumb terminal can be used as follows:
|
||||
|
||||
```jldoctest; setup = :(using Gnuplot; origterm = Gnuplot.options.term)
|
||||
julia> Gnuplot.options.term = "dumb size 60,15";
|
||||
|
||||
julia> @gp "plot sin(x)"
|
||||
|
||||
1 +-------------------------------------------------+
|
||||
0.8 |-+ *+ * + ** ** + * * +-|
|
||||
0.6 |-+ * ** * * sin(x) *******-|
|
||||
0.4 |*+ * * * * * *+-|
|
||||
0.2 |*+ * * * * * *-|
|
||||
0 |*+ * * * * * *-|
|
||||
| * * * * * * *|
|
||||
-0.2 |-* * * * * * +*|
|
||||
-0.4 |-+* * * * * * +*|
|
||||
-0.6 |-+* * * * ** * +-|
|
||||
-0.8 |-+ * * + ** ** + * * +-|
|
||||
-1 +-------------------------------------------------+
|
||||
-10 -5 0 5 10
|
||||
|
||||
julia> Gnuplot.options.term = origterm;
|
||||
|
||||
```
|
||||
A sixel plot on `xterm` looks as follows:
|
||||

|
||||
|
||||
The above terminals are available if gnuplot has been compiled with the `--with-bitmap-terminals` option enabled and Libgd (only for `sixelgd`).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user