# How to print a tree "vertically" defined by \`AbstractTrees.jl\`

**URL:** <https://discourse.julialang.org/t/how-to-print-a-tree-vertically-defined-by-abstracttrees-jl/56729>\
**Category:** General Usage\
**Tags:** visualization, tree\
**Created:** [March 8, 2021, 12:46pm UTC](https://discourse.julialang.org/t/how-to-print-a-tree-vertically-defined-by-abstracttrees-jl/56729 "2021-03-08T12:46:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shuhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuhua/32/27618_2.png) [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Post date:** [March 8, 2021, 12:46pm UTC](https://discourse.julialang.org/t/how-to-print-a-tree-vertically-defined-by-abstracttrees-jl/56729/1 "2021-03-08T12:46:24Z")

</div>

See the following example.

```julia
julia> using AbstractTrees

julia> function AbstractTrees.children(i::Integer)
           if i <= 3
               return i + 1, i + 2
           end 
           return ()
       end
julia> print_tree(1)
1
├─ 2
│ ├─ 3
│ │ ├─ 4
│ │ └─ 5
│ └─ 4
└─ 3
   ├─ 4
   └─ 5

```

Does there exist any package or utility method to print a tree in its _normal_ looking? That is, I want the form below

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/3/33ef40a47642b70e629fb58153c781df1f078e9a.jpeg)

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 8, 2021, 12:49pm UTC](https://discourse.julialang.org/t/how-to-print-a-tree-vertically-defined-by-abstracttrees-jl/56729/2 "2021-03-08T12:49:24Z")

</div>

Perhaps try [GitHub - JuliaGraphs/GraphPlot.jl: Graph visualization for Julia.](https://github.com/JuliaGraphs/GraphPlot.jl). Probably have to tweak settings to get it to look the way you want.

---

<div class="post-metadata">

**Author:** ![Shuhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuhua/32/27618_2.png) [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Post date:** [March 8, 2021, 1:57pm UTC](https://discourse.julialang.org/t/how-to-print-a-tree-vertically-defined-by-abstracttrees-jl/56729/3 "2021-03-08T13:57:53Z")

</div>

Thanks. I believe `Graphviz` is also a good choice for printing into a file. However, I want to print the above tree into the terminal.
