diff options
| author | Björn B. Brandenburg <bbb@cs.unc.edu> | 2010-11-24 13:10:04 -0500 |
|---|---|---|
| committer | Björn B. Brandenburg <bbb@cs.unc.edu> | 2010-11-24 13:11:56 -0500 |
| commit | a0d1ba571c117d3b32da73f02e5cc38b1bba5164 (patch) | |
| tree | cc3ab3aeb2e95759362402b242808cf7511ad730 /gnuplot.py | |
| parent | d2c2d0ca0083639df1562bda414d69e207b0d9be (diff) | |
Allow different coordinate systems to be used in Label()
Diffstat (limited to 'gnuplot.py')
| -rwxr-xr-x | gnuplot.py | 9 |
1 files changed, 6 insertions, 3 deletions
| @@ -25,14 +25,17 @@ class CommandBuffer(object): | |||
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | class Label(object): | 27 | class 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() |
