aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn B. Brandenburg <bbb@cs.unc.edu>2010-11-24 13:10:04 -0500
committerBjörn B. Brandenburg <bbb@cs.unc.edu>2010-11-24 13:11:56 -0500
commita0d1ba571c117d3b32da73f02e5cc38b1bba5164 (patch)
treecc3ab3aeb2e95759362402b242808cf7511ad730
parentd2c2d0ca0083639df1562bda414d69e207b0d9be (diff)
Allow different coordinate systems to be used in Label()
-rwxr-xr-xgnuplot.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/gnuplot.py b/gnuplot.py
index b0db2c9..fae329d 100755
--- a/gnuplot.py
+++ b/gnuplot.py
@@ -25,14 +25,17 @@ class CommandBuffer(object):
25 25
26 26
27class Label(object): 27class Label(object):
28 def __init__(self, x, y, txt): 28 def __init__(self, x, y, txt, coord=['', ''], align='center'):
29 self.x = x 29 self.x = x
30 self.y = y 30 self.y = y
31 self.txt = txt 31 self.txt = txt
32 # support more label stuff optionally... 32 self.coord = coord
33 self.align = align
34 # support more label stuff optionally...
33 35
34 def gnuplot_cmd(self): 36 def gnuplot_cmd(self):
35 return '"%s" at %f,%f center' % (self.txt, self.x, self.y) 37 return '"%s" at %s %f, %s %f %s' % \
38 (self.txt, self.coord[0], self.x, self.coord[1], self.y, self.align)
36 39
37 def __str__(self): 40 def __str__(self):
38 return 'set label %s' % self.gnuplot_cmd() 41 return 'set label %s' % self.gnuplot_cmd()