Update.
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path += ['..']
|
||||
|
||||
from pyltk import subfloat, tabular, resizebox, makebox, figure
|
||||
from pyltk.tikz import tikzpicture, errorbars_plot, coordinates_plot
|
||||
from pyltk.tikz import tikzpicture
|
||||
from pyltk.pgfplots import axis, errorbars_plot, coordinates_plot
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
data = [[1.00000000e+00,
|
||||
4.57213083e+00],
|
||||
[2.00000000e+00,
|
||||
1.16046200e+01],
|
||||
[ 4.00000000e+00,
|
||||
1.16046200e+01],
|
||||
[4.00000000e+00,
|
||||
2.71873880e+01],
|
||||
[ 5.00000000e+00,
|
||||
3.36039380e+01],
|
||||
@@ -21,30 +24,57 @@ if __name__ == "__main__":
|
||||
[ 2.00000000e+01,
|
||||
1.50422028e+02]]
|
||||
|
||||
tk = tikzpicture()
|
||||
tk.addaxis(coordinates_plot('test', data),
|
||||
xlabel='', ylabel='Computation Time [s]')
|
||||
tk1 = tikzpicture()
|
||||
tk1.add(axis(coordinates_plot('test', data),
|
||||
xlabel='', ylabel='Computation Time [s]'))
|
||||
|
||||
tk2 = tikzpicture()
|
||||
tk2.addaxis(errorbars_plot('test 2', [
|
||||
tk2.add(axis(errorbars_plot('test 2', [
|
||||
[0, 5, (2, 3)],
|
||||
[1, 8, (4, 5)]
|
||||
]))
|
||||
])))
|
||||
|
||||
tk3 = tikzpicture()
|
||||
tk3.addaxis(errorbars_plot('test 2', [
|
||||
tk3.add(axis(errorbars_plot('test 2', [
|
||||
[0, 5, 3],
|
||||
[4, 8, 4]
|
||||
]))
|
||||
])))
|
||||
|
||||
s1 = subfloat(tk, 'Caption 1')
|
||||
s2 = subfloat(tk2, 'Caption 2')
|
||||
s3 = subfloat(tk3, 'Caption 3')
|
||||
s4 = subfloat('', 'Caption 4')
|
||||
tk4 = tikzpicture()
|
||||
tk4.add(axis(coordinates_plot('test', [])))
|
||||
|
||||
tab = tabular([
|
||||
[resizebox(s1, 0.5), resizebox(s2, 0.5)],
|
||||
[resizebox(s3, 0.5), resizebox(s4, 0.5)]
|
||||
], columns='cc')
|
||||
s1 = subfloat('Caption 1', childrens=tk1)
|
||||
s2 = subfloat('Caption 2', childrens=tk2)
|
||||
s3 = subfloat('Caption 3', childrens=tk3)
|
||||
s4 = subfloat('Caption 4', childrens=tk4)
|
||||
|
||||
print(figure(makebox(tab), '!h'))
|
||||
tab = tabular(rows=[
|
||||
[s1, s2],
|
||||
[s3, s4]
|
||||
], columns='cc', autowrap=resizebox)
|
||||
|
||||
f = figure(makebox(tab), '!h')
|
||||
print(f) # f.childrens[0].childrens[0].childrens)
|
||||
|
||||
wrap = """\\documentclass{{article}}
|
||||
\\usepackage{{amsmath,amsfonts,amssymb}}
|
||||
\\usepackage{{tabularx}}
|
||||
\\usepackage{{multirow}}
|
||||
\\usepackage{{stmaryrd}}
|
||||
\\usepackage{{hhline}}
|
||||
\\usepackage{{caption}}
|
||||
\\usepackage{{tikz}}
|
||||
\\usetikzlibrary{{arrows}}
|
||||
\\usetikzlibrary{{positioning}}
|
||||
\\usepackage{{subfig}}
|
||||
\\usepackage{{pgfplots}}
|
||||
|
||||
\\begin{{document}}
|
||||
{content}
|
||||
\\end{{document}}""".format(content=f)
|
||||
|
||||
with open('/tmp/test.tex', 'w') as fd:
|
||||
fd.write(wrap)
|
||||
|
||||
os.system('pdflatex /tmp/test.tex')
|
||||
os.system('evince test.pdf')
|
||||
|
Reference in New Issue
Block a user