PrettyTables.jl + Makie.jl

Will it be possible to insert https://github.com/ronisbr/PrettyTables.jl
on an axis ?

If you are looking for a text formatted table, PrettyTables can return a table as a String, which can be plotted with text:

using CairoMakie, FileIO, PrettyTables

fig = Figure();
ax = fig[1,1] = Axis(fig);
xlims!(ax, -1, 5);
ylims!(ax, 0, 2);
hidespines!(ax);
hidedecorations!(ax);

pt = pretty_table(String, rand(4,3); header = ["a", "b", "c"]);
text!(ax, pt; font = "JuliaMono");

I’m not sure how to figure out the size of the table, though.

4 Likes

Table size will change with text size:

text!(ax, pt; font = "Hack", textsize = 10);

That works, but the formatting gets messed up :frowning:

You should use a monospaced font.

1 Like

Not sure if this requires a new post, but is there a way to make crayon formatted table strings work with Makie text ?

I know that text supports variable styling, but it’s much easier to handle conditional formatting with PrettyTables

Not PrettyTables per se, but I have this draft for inspiration Makie table extension by jkrumbiegel · Pull Request #24 · PumasAI/SummaryTables.jl · GitHub

At least that’s the spirit of what I’d like to do with PrettyTables.