Hello,
Does anyone know how to write a column of, say, three small Pretty Tables tables followed by a plot to a png file with mankie.jl or with some other tool?
Thanks
You mean you want to put a table inside a Makie plot? I once made this but didn’t merge it Makie table extension by jkrumbiegel · Pull Request #24 · PumasAI/SummaryTables.jl · GitHub
But in principle, yeah, you can build a table with GridLayout, Label and Box
using CairoMakie
table_text = DataFrame(
Category = ["All Counties", "Served Counties", "Served Population"],
Count = [all_counties, served_counties, served_population],
Percentage = ["100%", percentage_counties_served, percentage_served_population]
)
io = IOBuffer()
pretty_table(io, table_text; backend=:text, alignment=[:l, :r, :r], show_first_column_label_only = true)
str_table = String(take!(io))
Then just place it in a Figure object.
f = Figure()
ax = Axis()
Label(axis, str_table, font="IBM Plex Mono", fontsize=10, justification=:left, halign=:left, valign=:bottom)
save("output.png", f)
Use GridLayout() to arrange multiple tables.
3 Likes
