我想用DataFrames.jl包中的Makie.jl或朱莉娅中的任何其他绘图库绘制数据的表格表示。另一种选择是将dataframe保存为图像。
发布于 2022-09-03 10:27:02
您只需使用annotate!
,只需记住Plots.jl内置的monospace
字体并不能很好地支持所有Unicode字符,因此您需要使用更简单的表格式(标记格式实际上看起来很好,很好)。另一方面,Makie似乎支持系统字体,因此您可以获得更好的格式。
using DataFrames, PrettyTables, Plots
pyplot()
df=DataFrame(a=1:5,b='a':'e',c=rand(5))
io = IOBuffer()
pretty_table(io, df, tf = tf_markdown, show_row_number = true)
str = String(io.data)
plot() # do whatever plotting you need
annotate!(0.5, 0.5, text(str; family="monospace", pointsize=8))
下面是与Makie相同的示例:
using CairoMakie, Makie
f = Figure()
ax = Axis(f[1, 1])
io = IOBuffer()
pretty_table(io, df)
str = String(io.data)
text(5,5, text=str, font="Consolas", textsize=14)
https://stackoverflow.com/questions/73567468
复制相似问题