Author: tlinnet Date: Mon Oct 13 18:19:36 2014 New Revision: 26262 URL: http://svn.gna.org/viewcvs/relax?rev=26262&view=rev Log: Added better figure control of chi2 values on z-axis for surface plots. Modified: trunk/pipe_control/opendx.py Modified: trunk/pipe_control/opendx.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/opendx.py?rev=26262&r1=26261&r2=26262&view=diff ============================================================================== --- trunk/pipe_control/opendx.py (original) +++ trunk/pipe_control/opendx.py Mon Oct 13 18:19:36 2014 @@ -470,6 +470,7 @@ plot_file = open_write_file(file_name=self.file_prefix+'.py', dir=self.dir, force=True) matplotlib_file = [ + 'from copy import deepcopy'+"\n", 'import numpy as np'+"\n", 'import scipy.interpolate'+"\n", 'from numpy.ma import masked_where'+"\n", @@ -565,21 +566,24 @@ ' # Set which x, y, z to plot'+"\n", ' x_p = xi'+"\n", ' y_p = yi'+"\n", - ' c_p = ci'+"\n", + ' c_p = deepcopy(ci)'+"\n", ''+"\n", ' # Cut map at a certain height.'+"\n", ' # First get index os largest values'+"\n", - ' #out_val = 5*map_mask_c_min'+"\n", - ' out_val = map_mask_c_max'+"\n", - ' ci_mask = masked_where(ci >= out_val, ci)'+"\n", + ' #z_max = map_mask_c_max'+"\n", + ' z_max = map_mask_c_min + 0.5*map_mask_c_min'+"\n", + ' ci_mask = masked_where(ci >= z_max, ci)'+"\n", ''+"\n", ' # Replace with 0.0'+"\n", - ' ci[ci_mask.mask] = 0.0'+"\n", + ' c_p[ci_mask.mask] = 0.0'+"\n", ' # Find new max'+"\n", - ' new_max = np.max(ci)'+"\n", + ' new_max = np.max(c_p)'+"\n", ''+"\n", ' # Insert values in array.'+"\n", - ' ci[ci_mask.mask] = new_max'+"\n", + ' c_p[ci_mask.mask] = new_max'+"\n", + ''+"\n", + ' # Define min.'+"\n", + ' z_min = map_mask_c_min - 0.5*map_mask_c_min'+"\n", ''+"\n", ' # Create figure and plot'+"\n", ' ax = fig.add_subplot(nr_rows, nr_cols, 1, projection="3d")'+"\n", @@ -592,7 +596,7 @@ ' ##ax.scatter(x_p, y_p, c_p, c="y", marker="o", s=5)'+"\n", ''+"\n", ' # Add contour levels on sides.'+"\n", - ' ax.contour(x_p, y_p, c_p, zdir="z", offset=0, cmap=cm.coolwarm)'+"\n", + ' ax.contour(x_p, y_p, c_p, zdir="z", offset=z_min, cmap=cm.coolwarm)'+"\n", ' ax.contour(x_p, y_p, c_p, zdir="x", offset=map_mask_x_min, cmap=cm.coolwarm)'+"\n", ' ax.contour(x_p, y_p, c_p, zdir="y", offset=map_mask_y_min, cmap=cm.coolwarm)'+"\n", ''+"\n", @@ -653,7 +657,7 @@ ''+"\n", ''+"\n", ' # Set limits'+"\n", - ' ax.set_zlim(0, out_val)'+"\n", + ' ax.set_zlim(z_min, z_max)'+"\n", ''+"\n", ''+"\n", ' # Create figure and plot'+"\n",