Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick and dirty support for xlabel attribute in TIKZ. #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions dot2tex/dot2tex.py
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,26 @@ def do_nodes(self):
sn = ""
sn += self.output_node_comment(node)
sn += self.start_node(node)

# Quick and dirty introduction of handling for xlabel
# xlabel = self.get_label(node, label_attribute="xlabel")
xlabel = None
if 'xlabel' in node.attr:
#node.attr['texlbl'] = node.attr['xlabel']
node.attr['texlbl'] = None
xlabel = self.get_label(node,label_attribute="xlabel")
#xlabel = node.attr['xlabel'] if 'xlabel' in node.attr else None
if xlabel is not None:
#xlpos = "%sbp,%sbp" % (smart_float(str(float(x)+len(xlabel)*5)), smart_float(y))
xlp = getattr(node, 'xlp', None)
if not xlp:
continue
xlpx, xlpy = xlp.split(',')
xlpx = str(abs(float(x)-float(xlpx))+float(x))
xlpy = y
xlpos = "%sbp,%sbp" % (smart_float(xlpx), smart_float(xlpy))
sn += " \\node (%s) at (%s) [%s] {%s};\n" % \
(tikzify(node.name+"xl"), xlpos, "", xlabel)
if shape == "coordinate":
sn += " \\coordinate (%s) at (%s);\n" % (tikzify(node.name), pos)
elif self.options.get('styleonly'):
Expand Down