Formats
The following table formats are available:
unicode
(Default)
┌────────┬────────┬────────┬────────┐
│ Col. 1 │ Col. 2 │ Col. 3 │ Col. 4 │
├────────┼────────┼────────┼────────┤
│ 1 │ false │ 1.0 │ 1 │
│ 2 │ true │ 2.0 │ 2 │
│ 3 │ false │ 3.0 │ 3 │
└────────┴────────┴────────┴────────┘
ascii_dots
.....................................
: Col. 1 : Col. 2 : Col. 3 : Col. 4 :
:........:........:........:........:
: 1 : false : 1.0 : 1 :
: 2 : true : 2.0 : 2 :
: 3 : false : 3.0 : 3 :
:........:........:........:........:
ascii_rounded
.--------.--------.--------.--------.
| Col. 1 | Col. 2 | Col. 3 | Col. 4 |
:--------+--------+--------+--------:
| 1 | false | 1.0 | 1 |
| 2 | true | 2.0 | 2 |
| 3 | false | 3.0 | 3 |
'--------'--------'--------'--------'
borderless
Col. 1 Col. 2 Col. 3 Col. 4
1 false 1.0 1
2 true 2.0 2
3 false 3.0 3
compact
-------- -------- -------- --------
Col. 1 Col. 2 Col. 3 Col. 4
-------- -------- -------- --------
1 false 1.0 1
2 true 2.0 2
3 false 3.0 3
-------- -------- -------- --------
markdown
| Col. 1 | Col. 2 | Col. 3 | Col. 4 |
|--------|--------|--------|--------|
| 1 | false | 1.0 | 1 |
| 2 | true | 2.0 | 2 |
| 3 | false | 3.0 | 3 |
mysql
+--------+--------+--------+--------+
| Col. 1 | Col. 2 | Col. 3 | Col. 4 |
+--------+--------+--------+--------+
| 1 | false | 1.0 | 1 |
| 2 | true | 2.0 | 2 |
| 3 | false | 3.0 | 3 |
+--------+--------+--------+--------+
simple
========= ======== ======== =========
Col. 1 Col. 2 Col. 3 Col. 4
========= ======== ======== =========
1 false 1.0 1
2 true 2.0 2
3 false 3.0 3
========= ======== ======== =========
unicode_rounded
╭────────┬────────┬────────┬────────╮
│ Col. 1 │ Col. 2 │ Col. 3 │ Col. 4 │
├────────┼────────┼────────┼────────┤
│ 1 │ false │ 1.0 │ 1 │
│ 2 │ true │ 2.0 │ 2 │
│ 3 │ false │ 3.0 │ 3 │
╰────────┴────────┴────────┴────────╯
Note
The format unicode_rounded
should look awful on your browser, but it should be printed fine on your terminal.
julia> data = Any[ f(a) for a = 0:15:90, f in (sind,cosd,tand)];
julia> pretty_table(data, ascii_dots)
..................................................................
: Col. 1 : Col. 2 : Col. 3 :
:.....................:.....................:....................:
: 0.0 : 1.0 : 0.0 :
: 0.25881904510252074 : 0.9659258262890683 : 0.2679491924311227 :
: 0.5 : 0.8660254037844386 : 0.5773502691896258 :
: 0.7071067811865476 : 0.7071067811865476 : 1.0 :
: 0.8660254037844386 : 0.5 : 1.7320508075688772 :
: 0.9659258262890683 : 0.25881904510252074 : 3.7320508075688776 :
: 1.0 : 0.0 : Inf :
:.....................:.....................:....................:
julia> pretty_table(data, compact)
--------------------- --------------------- --------------------
Col. 1 Col. 2 Col. 3
--------------------- --------------------- --------------------
0.0 1.0 0.0
0.25881904510252074 0.9659258262890683 0.2679491924311227
0.5 0.8660254037844386 0.5773502691896258
0.7071067811865476 0.7071067811865476 1.0
0.8660254037844386 0.5 1.7320508075688772
0.9659258262890683 0.25881904510252074 3.7320508075688776
1.0 0.0 Inf
--------------------- --------------------- --------------------
It is also possible to define you own custom table by creating a new instance of the structure PrettyTableFormat
. For example, let's say that you want a table like simple
that does not print the bottom line:
julia> data = Any[ f(a) for a = 0:15:90, f in (sind,cosd,tand)];
julia> tf = PrettyTableFormat(simple, bottom_line = false);
julia> pretty_table(data, tf)
====================== ===================== =====================
Col. 1 Col. 2 Col. 3
====================== ===================== =====================
0.0 1.0 0.0
0.25881904510252074 0.9659258262890683 0.2679491924311227
0.5 0.8660254037844386 0.5773502691896258
0.7071067811865476 0.7071067811865476 1.0
0.8660254037844386 0.5 1.7320508075688772
0.9659258262890683 0.25881904510252074 3.7320508075688776
1.0 0.0 Inf
or that does not print the header line:
julia> data = Any[ f(a) for a = 0:15:90, f in (sind,cosd,tand)];
julia> tf = PrettyTableFormat(simple, header_line = false);
julia> pretty_table(data, tf)
====================== ===================== =====================
Col. 1 Col. 2 Col. 3
0.0 1.0 0.0
0.25881904510252074 0.9659258262890683 0.2679491924311227
0.5 0.8660254037844386 0.5773502691896258
0.7071067811865476 0.7071067811865476 1.0
0.8660254037844386 0.5 1.7320508075688772
0.9659258262890683 0.25881904510252074 3.7320508075688776
1.0 0.0 Inf
====================== ===================== =====================
For more information, see the documentation of the structure PrettyTableFormat
.