From e07164bf5e6bd064e728f38aeb24805823009dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=2E=20Brandenburg?= Date: Sun, 23 May 2010 12:47:17 -0400 Subject: add simple linedemo mode to view default line styles --- gnuplot.py | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'gnuplot.py') diff --git a/gnuplot.py b/gnuplot.py index 2604cb0..1a55fc6 100755 --- a/gnuplot.py +++ b/gnuplot.py @@ -166,14 +166,7 @@ class GnuPlotter(defapp.App): def __init__(self): defapp.App.__init__(self, options, defaults, no_std_opts=True) - def get_cmd(self, args): - graphs = [] - while len(args) >= 4: - g = args[0:4] - graphs += [g] - args = args[4:] - if args: - self.err("Warning: Ignoring trailing args. Args:", *args) + def make_cmd(self, graphs): return gnuplot_cmd(graphs, title=self.options.title, format=self.options.format, @@ -186,7 +179,17 @@ class GnuPlotter(defapp.App): yticks=self.options.yticks, fname=self.options.out, term_opts=self.options.term_opts) - + + def get_cmd(self, args): + graphs = [] + while len(args) >= 4: + g = args[0:4] + graphs += [g] + args = args[4:] + if args: + self.err("Warning: Ignoring trailing args. Args:", *args) + return self.make_cmd(graphs) + def default(self, _): cmd = self.get_cmd(list(self.args)) pipe2gnuplot(cmd) @@ -195,5 +198,20 @@ class GnuPlotter(defapp.App): cmd = self.get_cmd(self.args[1:]) self.out(cmd) + def do_linedemo(self, _): + graphs = ["%d title 'ls %d'" % (x, x) #, x) # with linespoints ls %d + for x in xrange(1,10)] + self.options.yrange = (0, 10) + self.options.xrange = (0, 10) + self.options.xticks = (0, 10) + self.options.yticks = (0, 1) + self.options.title = "%s Default Line Styles" % self.options.format.upper() + self.options.ylabel = "Styles" + self.options.term_opts = "" # avoid default + + cmd = self.make_cmd(graphs) + pipe2gnuplot(cmd) + + if __name__ == "__main__": GnuPlotter().launch() -- cgit v1.2.2