Author: bugman Date: Thu Nov 21 15:10:04 2013 New Revision: 21579 URL: http://svn.gna.org/viewcvs/relax?rev=21579&view=rev Log: Merged revisions 21578 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r21578 | bugman | 2013-11-21 15:07:21 +0100 (Thu, 21 Nov 2013) | 6 lines Improved Grace graph scaling and arrangement when multiple graphs are present. The lib.software.grace.write_xy_data() function now executes the 'autoscale' command for each graph and executes the 'arrange' to layout the graphs automatically. ........ Modified: branches/relax_disp/ (props changed) branches/relax_disp/lib/software/grace.py Propchange: branches/relax_disp/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Thu Nov 21 15:10:04 2013 @@ -1,1 +1,1 @@ -/trunk:1-21494 +/trunk:1-21578 Modified: branches/relax_disp/lib/software/grace.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/software/grace.py?rev=21579&r1=21578&r2=21579&view=diff ============================================================================== --- branches/relax_disp/lib/software/grace.py (original) +++ branches/relax_disp/lib/software/grace.py Thu Nov 21 15:10:04 2013 @@ -22,6 +22,9 @@ # Module docstring. """Module for interfacing with Grace (also known as Xmgrace, Xmgr, and ace).""" + +# Python module imports. +from math import ceil, sqrt # relax module imports. import pipe_control @@ -144,8 +147,11 @@ elif graph_type == 'xydxdy': comment_col = 4 + # Graph number. + g_num = len(data) + # Loop over the graphs. - for gi in range(len(data)): + for gi in range(g_num): # Loop over the data sets of the graph. for si in range(len(data[gi])): # The target and type. @@ -199,7 +205,15 @@ file.write("&\n") # Autoscaling of all graphs to avoid user confusion. - file.write("@autoscale\n") + for i in range(g_num): + file.write("@with g%i\n" % i) + file.write("@autoscale\n") + + # Auto-arrange the graphs if multiple are present. + if len(data) > 1: + row_num = int(round(sqrt(len(data)))) + col_num = int(ceil(sqrt(len(data)))) + file.write("@arrange(%i, %i, .05, .05, .05, ON, ON, ON)\n" % (row_num, col_num)) def write_xy_header(file=None, paper_size='A4', title=None, subtitle=None, view=None, sets=1, set_names=None, set_colours=None, symbols=None, symbol_sizes=None, symbol_fill=None, linestyle=None, linetype=None, linewidth=0.5, data_type=None, seq_type=None, axis_labels=None, legend=True, legend_pos=None, legend_box_fill_pattern=1, legend_char_size=1.0, norm=False):