diff options
-rwxr-xr-x | gnuplot.py | 36 |
1 files changed, 27 insertions, 9 deletions
@@ -166,14 +166,7 @@ class GnuPlotter(defapp.App): | |||
166 | def __init__(self): | 166 | def __init__(self): |
167 | defapp.App.__init__(self, options, defaults, no_std_opts=True) | 167 | defapp.App.__init__(self, options, defaults, no_std_opts=True) |
168 | 168 | ||
169 | def get_cmd(self, args): | 169 | def make_cmd(self, graphs): |
170 | graphs = [] | ||
171 | while len(args) >= 4: | ||
172 | g = args[0:4] | ||
173 | graphs += [g] | ||
174 | args = args[4:] | ||
175 | if args: | ||
176 | self.err("Warning: Ignoring trailing args. Args:", *args) | ||
177 | return gnuplot_cmd(graphs, | 170 | return gnuplot_cmd(graphs, |
178 | title=self.options.title, | 171 | title=self.options.title, |
179 | format=self.options.format, | 172 | format=self.options.format, |
@@ -186,7 +179,17 @@ class GnuPlotter(defapp.App): | |||
186 | yticks=self.options.yticks, | 179 | yticks=self.options.yticks, |
187 | fname=self.options.out, | 180 | fname=self.options.out, |
188 | term_opts=self.options.term_opts) | 181 | term_opts=self.options.term_opts) |
189 | 182 | ||
183 | def get_cmd(self, args): | ||
184 | graphs = [] | ||
185 | while len(args) >= 4: | ||
186 | g = args[0:4] | ||
187 | graphs += [g] | ||
188 | args = args[4:] | ||
189 | if args: | ||
190 | self.err("Warning: Ignoring trailing args. Args:", *args) | ||
191 | return self.make_cmd(graphs) | ||
192 | |||
190 | def default(self, _): | 193 | def default(self, _): |
191 | cmd = self.get_cmd(list(self.args)) | 194 | cmd = self.get_cmd(list(self.args)) |
192 | pipe2gnuplot(cmd) | 195 | pipe2gnuplot(cmd) |
@@ -195,5 +198,20 @@ class GnuPlotter(defapp.App): | |||
195 | cmd = self.get_cmd(self.args[1:]) | 198 | cmd = self.get_cmd(self.args[1:]) |
196 | self.out(cmd) | 199 | self.out(cmd) |
197 | 200 | ||
201 | def do_linedemo(self, _): | ||
202 | graphs = ["%d title 'ls %d'" % (x, x) #, x) # with linespoints ls %d | ||
203 | for x in xrange(1,10)] | ||
204 | self.options.yrange = (0, 10) | ||
205 | self.options.xrange = (0, 10) | ||
206 | self.options.xticks = (0, 10) | ||
207 | self.options.yticks = (0, 1) | ||
208 | self.options.title = "%s Default Line Styles" % self.options.format.upper() | ||
209 | self.options.ylabel = "Styles" | ||
210 | self.options.term_opts = "" # avoid default | ||
211 | |||
212 | cmd = self.make_cmd(graphs) | ||
213 | pipe2gnuplot(cmd) | ||
214 | |||
215 | |||
198 | if __name__ == "__main__": | 216 | if __name__ == "__main__": |
199 | GnuPlotter().launch() | 217 | GnuPlotter().launch() |