@@ -63,23 +63,6 @@ Printing is LaTeX format is achieved with `pretty_latex_stats`:
6363pretty_latex_stats(stats[:alpha])
6464```
6565
66- Alternatively, you can print to a file.
67-
68- ```julia
69- open("alpha.tex", "w") do io
70- println(io, "\\documentclass[varwidth=20cm,crop=true]{standalone}")
71- println(io, "\\usepackage{longtable}[=v4.13]")
72- println(io, "\\begin{document}")
73- pretty_latex_stats(io, stats[:alpha])
74- println(io, "\\end{document}")
75- end
76- ```
77-
78- ```julia
79- run(`latexmk -quiet -pdf alpha.tex`)
80- run(`pdf2svg alpha.pdf alpha.svg`)
81- ```
82-
8366If only a subset of columns should be printed, the DataFrame should be indexed accordingly:
8467
8568```julia
@@ -143,31 +126,21 @@ Thus we must first disable them for the `time` column using `col_formatters`, an
143126fmt_override = Dict(:f => "%+10.3e",
144127 :t => "%08.2f")
145128hdr_override = Dict(:name => "Name", :f => "f(x)", :t => "Time")
146- open("alpha2.tex", "w") do io
147- println(io, "\\documentclass[varwidth=20cm,crop=true]{standalone}")
148- println(io, "\\usepackage{longtable}[=v4.13]")
149- println(io, "\\begin{document}")
150- pretty_latex_stats(io,
151- df[!, [:name, :status, :f, :t, :iter]],
152- col_formatters = Dict(:t => "%f"), # disable default formatting of t
153- formatters = (v,i,j) -> begin
154- if j == 4
155- xi = floor(Int, v)
156- minutes = div(xi, 60)
157- seconds = xi % 60
158- micros = round(Int, 1e6 * (v - xi))
159- @sprintf("\\(%2d\\)m \\(%02d\\)s \\(%06d \\mu\\)s", minutes, seconds, micros)
160- else
161- v
162- end
163- end)
164- println(io, "\\end{document}")
129+ pretty_latex_stats(
130+ df[!, [:name, :status, :f, :t, :iter]],
131+ col_formatters = Dict(:t => "%f"), # disable default formatting of t
132+ formatters = (v,i,j) -> begin
133+ if j == 4
134+ xi = floor(Int, v)
135+ minutes = div(xi, 60)
136+ seconds = xi % 60
137+ micros = round(Int, 1e6 * (v - xi))
138+ @sprintf("\\(%2d\\)m \\(%02d\\)s \\(%06d \\mu\\)s", minutes, seconds, micros)
139+ else
140+ v
141+ end
165142end
166- ```
167-
168- ```julia
169- run(`latexmk -quiet -pdf alpha2.tex`)
170- run(`pdf2svg alpha2.pdf alpha2.svg`)
143+ )
171144```
172145
173146### Joining tables
@@ -200,18 +173,7 @@ pretty_stats(stdout, df)
200173```julia
201174hdr_override = Dict(:name => "Name", :f => "\\(f(x)\\)", :t => "Time")
202175df = join(stats, [:f, :t], invariant_cols=[:name], hdr_override=hdr_override)
203- open("alpha3.tex", "w") do io
204- println(io, "\\documentclass[varwidth=20cm,crop=true]{standalone}")
205- println(io, "\\usepackage{longtable}[=v4.13]")
206- println(io, "\\begin{document}")
207- pretty_latex_stats(io, df)
208- println(io, "\\end{document}")
209- end
210- ```
211-
212- ```julia
213- run(`latexmk -quiet -pdf alpha3.tex`)
214- run(`pdf2svg alpha3.pdf alpha3.svg`)
176+ pretty_latex_stats(df)
215177```
216178
217179## Profiles
@@ -228,7 +190,6 @@ applied to a `DataFrame` and returning a vector.
228190
229191```julia
230192using Plots
231- pyplot()
232193
233194p = performance_profile(stats, df -> df.t)
234195```
0 commit comments