From: Michael H. <mh...@al...> - 2015-12-22 15:51:16
|
On 12/18/2015 04:13 PM, Bernhard Hopfenmüller wrote: > > Dear Gnuplot-py-user List, > > I have a problem I cannot quite solve, maybe somebody has a good idea? > > So I have a script plotting all files of one folder in one graph. > I have the files already in a list "fileList": > Files belong to one of 2 groups, eg: > > file1_apple.txt > file2_apple.txt > file3_apple.txt > file1_pear.txt > file2_pear.txt > . > . > . > > > I want now all files of one group to be plotted with the same symbol and > color. How do I do this? > It is sadly not working as I indicate it here > > for cur_file in fileList: > group = files.split("_")[1] > > if group== "apple": > f = Gnuplot.File(cur_file) > f.set_option(with_='points', linecolor = , linestyle = ) > f.set_option(title=apple) > plotlist_apple.append(f) > > if group == "pear": > f = Gnuplot.File(cur_file) > f.set_option(with_='points', linecolor =, linestyle = ) > f.set_option(title=pear) > plotlist_pear.append(f) > > #print plotlist > g.plot(*plotlist_pear,*plotlist_apple) > > Also has anybody a hint how to plot that afterwards in one plot? Your example isn't complete so it's hard to be sure. But at least part of the problem is that the last line has a syntax error. It is not possible to pass two splatted lists to a single function invocation in this way. (Why not? I don't know. It seems like a reasonable thing to do. But whatever.) Instead, try g.plot(*(plotlist_pear + plotlist_apple)) ; i.e., combine the lists into a single list and then splat the big list into the function call. If that doesn't help, then please give us a more complete example, including what you see and the error output if any. Yours, Michael -- Michael Haggerty mh...@al... |