30 lines
613 B
Python
30 lines
613 B
Python
# -*- encoding: utf-8
|
|
|
|
from ..formatter import formatter
|
|
|
|
from .axis import axis
|
|
|
|
|
|
class tikzpicture:
|
|
""" Class representing a latex tikzfigure. """
|
|
|
|
fmt = formatter({
|
|
'content': """\\begin{{tikzpicture}}
|
|
{inner}
|
|
\\end{{tikzpicture}}"""
|
|
})
|
|
|
|
def __init__(self, axis=[]):
|
|
self.axis = []
|
|
|
|
def addaxis(self, *args, **kargs):
|
|
ax = args[0]
|
|
if not isinstance(ax, axis):
|
|
ax = axis(*args, **kargs)
|
|
self.axis.append(ax)
|
|
|
|
def __str__(self):
|
|
return self.fmt.format('content', {
|
|
'inner': '\n'.join(map(str, self.axis))
|
|
})
|