pyltk/tests/test_basic.py

51 lines
1.2 KiB
Python
Raw Normal View History

2017-05-16 09:00:50 +00:00
# -*- encoding: utf-8 -*-
import sys
sys.path += ['..']
from pyltk import subfloat, tabular, resizebox, makebox, figure
from pyltk.tikz import tikzpicture, errorbars_plot, coordinates_plot
if __name__ == "__main__":
data = [[1.00000000e+00,
4.57213083e+00],
[2.00000000e+00,
1.16046200e+01],
[ 4.00000000e+00,
2.71873880e+01],
[ 5.00000000e+00,
3.36039380e+01],
[ 1.00000000e+01,
7.21689923e+01],
[ 2.00000000e+01,
1.50422028e+02]]
tk = tikzpicture()
tk.addaxis(coordinates_plot('test', data),
xlabel='', ylabel='Computation Time [s]')
tk2 = tikzpicture()
tk2.addaxis(errorbars_plot('test 2', [
[0, 5, (2, 3)],
[1, 8, (4, 5)]
]))
tk3 = tikzpicture()
tk3.addaxis(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')
tab = tabular([
[resizebox(s1, 0.5), resizebox(s2, 0.5)],
[resizebox(s3, 0.5), resizebox(s4, 0.5)]
], columns='cc')
print(figure(makebox(tab), '!h'))