# \[ANN\] PrettyTables.jl v1.2.2

**URL:** <https://discourse.julialang.org/t/ann-prettytables-jl-v1-2-2/69193>\
**Category:** Package Announcements\
**Created:** [October 4, 2021, 2:19pm UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v1-2-2/69193 "2021-10-04T14:19:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [October 4, 2021, 2:19pm UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v1-2-2/69193/1 "2021-10-04T14:19:39Z")

</div>

Hi!

I just tag a new version of PrettyTables.jl (v1.2.2) and I would like to point out an amazing work done by @lorenzoh (GitHub, I am not sure if he is here in Discourse). He had an idea to use `CustomTextCell` so that we can have cells with ANSI escape sequences. Thus, we can now display anything inside a text cell composed of text and ANSI escape sequences (only those that change the decoration).

Hence, we can now create complex tables using PrettyTables to render tables inside cells:

```julia
julia> using PrettyTables

julia> sc1 = [7.4 73.5; 3.1 27.2; 2.5 15.6; 1.8 9.0];

julia> sc2 = [7.4 73.5; 3.1 27.2; 2.5 15.6; 1.8 9.0];

julia> case = ["< 5000", "5000 - 10000", "10000 - 15000", "> 15000"];

julia> str_sc1 = pretty_table(String, sc1, header = ["avg.", "max"], color = true, hlines = [:header], vlines = :none, newline_at_end = false, highlighters = hl_row(4, crayon"bold red"));
str
julia> str_sc2 = pretty_table(String, sc2, header = ["avg.", "max"], color = true, hlines = [:header], vlines = :none, newline_at_end = false, highlighters = hl_row(4, crayon"bold red"));

julia> str_case = pretty_table(String, case, header = [" "], color = true, hlines = [:header], vlines = :none, tf = tf_borderless, newline_at_end = false);

julia> table = [AnsiTextCell(str_case) AnsiTextCell(str_sc1) AnsiTextCell(str_sc2)];

```

 ![Captura de Tela 2021-10-04 às 11.02.17](https://global.discourse-cdn.com/julialang/original/3X/b/f/bfbe0df621582962056d142085e1f9a523b7bb64.png)

We can also add plots inside the table cells using UnicodePlots:

```julia
julia> using PrettyTables, UnicodePlots

julia> str_pop = sprint(io -> show(io, barplot(
           ["", "", ""],
           [12.396, 6.748, 0.729]
       )), context = :color => true);

julia> str_idh = sprint(io -> show(io, barplot(
           ["", "", ""],
           [0.805, 0.799, 0.807]
       )), context = :color => true);

julia> table = ["\nSão Paulo\nRio de Janeiro\nSão José dos Campos" AnsiTextCell(str_pop) AnsiTextCell(str_idh)];

julia> pretty_table(table, header = ["", "Population (in mil.)", "IDH"], alignment = :l, header_alignment = :c, linebreaks = true, vlines = :none, hlines = [:header])

```

 ![Captura de Tela 2021-10-04 às 11.15.43](https://global.discourse-cdn.com/julialang/original/3X/0/3/03ac5c009dba0bfbe9433822b2baf8770ed1d766.png)

---

<div class="post-metadata">

**Author:** ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Post date:** [October 4, 2021, 10:14pm UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v1-2-2/69193/2 "2021-10-04T22:14:59Z")

</div>

Holy Julia. I feel like I am living in a retro future of 1982 watching the output of my computer terminal.

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [October 5, 2021, 8:00am UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v1-2-2/69193/3 "2021-10-05T08:00:16Z")

</div>

Can it be used in Wave/Jupyter scripts to be rendered in an HTML/PDF document ?

---

<div class="post-metadata">

**Author:** ![holylorenzo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/holylorenzo/32/34169_2.png) [@holylorenzo](https://discourse.julialang.org/u/holylorenzo)\
**Post date:** [October 5, 2021, 9:40am UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v1-2-2/69193/4 "2021-10-05T09:40:08Z")

</div>

Main motivation to implement this for me was to use as a plotting backend in FastAI.jl, so stay tuned for that 👀 [PR](https://github.com/FluxML/FastAI.jl/pull/176). Below shows an example of nested tables and using ImageInTerminal.jl to render images inside the cells:

 ![](https://global.discourse-cdn.com/julialang/original/3X/2/8/28832f19c083dfb3fc8c523884b73224b16c69ba.png)

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [October 5, 2021, 11:21pm UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v1-2-2/69193/5 "2021-10-05T23:21:21Z")

</div>

Yes! But in this case you need to use the HTML backend which is not 100% stable yet.
