tadd colormap parameter - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
 (HTM) git clone git://src.adamsgaard.dk/sphere
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 9d9e5ba4f59c0dbafc66116261bd5766e48f380f
 (DIR) parent ee80d53c4362f39231c552e74b603418592a54fa
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Thu, 16 Apr 2015 10:29:45 +0200
       
       add colormap parameter
       
       Diffstat:
         M python/halfshear-darcy-fluid-press… |       2 +-
         M python/sphere.py                    |      59 +++++++++++++++++++++----------
       
       2 files changed, 42 insertions(+), 19 deletions(-)
       ---
 (DIR) diff --git a/python/halfshear-darcy-fluid-pressures.py b/python/halfshear-darcy-fluid-pressures.py
       t@@ -5,7 +5,7 @@ import shutil
        import seaborn as sns
        #sns.set(style='ticks', palette='Set2')
        #sns.set(style='ticks', palette='colorblind')
       -sns.set(style='ticks', palette='Set2')
       +sns.set(style='white', palette='Set2')
        sns.despine() # remove chartjunk
        
        
 (DIR) diff --git a/python/sphere.py b/python/sphere.py
       t@@ -5992,7 +5992,7 @@ class sim:
        
            def visualize(self, method='energy', savefig=True, outformat='png',
                    figsize=False, pickle=False, xlim=False, firststep=0, f_min=None,
       -            f_max=None):
       +            f_max=None, cmap=None):
                '''
                Visualize output from the simulation, where the temporal progress is
                of interest. The output will be saved in the current folder with a name
       t@@ -6018,6 +6018,9 @@ class sim:
                :type xlim: array
                :param firststep: The first output file step to read (default: 0)
                :type firststep: int
       +        :param cmap: Choose custom color map, e.g.
       +            `cmap=matplotlib.cm.get_cmap('afmhot')`
       +        :type cmap: matplotlib.colors.LinearSegmentedColormap
                '''
        
                lastfile = self.status()
       t@@ -6654,9 +6657,14 @@ class sim:
                    friction = tau_nonzero/N_nonzero
                    #CS = ax1.scatter(friction, v_nonzero, c=shearstrain_nonzero,
                            #linewidth=0)
       -            CS = ax1.scatter(friction, shearstrainrate_nonzero,
       -                    c=shearstrain_nonzero, linewidth=0.1,
       -                    cmap=matplotlib.cm.get_cmap('afmhot'))
       +            if cmap:
       +                CS = ax1.scatter(friction, shearstrainrate_nonzero,
       +                        c=shearstrain_nonzero, linewidth=0.1,
       +                        cmap=cmap)
       +            else:
       +                CS = ax1.scatter(friction, shearstrainrate_nonzero,
       +                        c=shearstrain_nonzero, linewidth=0.1,
       +                        cmap=matplotlib.cm.get_cmap('afmhot'))
                    ax1.set_yscale('log')
                    x_min = numpy.floor(numpy.min(friction))
                    x_max = numpy.ceil(numpy.max(friction))
       t@@ -6785,12 +6793,20 @@ class sim:
                            x = shear_strain
                        if xlim:
                            x = x[i_min:i_max]
       -                im1 = ax.pcolormesh(
       -                        x, zpos_c, pres,
       -                        cmap=matplotlib.cm.get_cmap('bwr'),
       -                        #cmap=matplotlib.cm.get_cmap('coolwarm'),
       -                        vmin=-p_ext, vmax=p_ext,
       -                        rasterized=True)
       +                if cmap:
       +                    im1 = ax.pcolormesh(
       +                            x, zpos_c, pres,
       +                            #cmap=matplotlib.cm.get_cmap('bwr'),
       +                            cmap=cmap,
       +                            vmin=-p_ext, vmax=p_ext,
       +                            rasterized=True)
       +                else:
       +                    im1 = ax.pcolormesh(
       +                            x, zpos_c, pres,
       +                            cmap=matplotlib.cm.get_cmap('bwr'),
       +                            #cmap=matplotlib.cm.get_cmap('coolwarm'),
       +                            vmin=-p_ext, vmax=p_ext,
       +                            rasterized=True)
                        ax.set_xlim([0, numpy.max(x)])
                        if sb.w_x[0] < sb.L[2]:
                            ax.set_ylim([zpos_c[0], sb.w_x[0]])
       t@@ -6850,14 +6866,21 @@ class sim:
                            x = t
                        else:
                            x = shear_strain
       -                im1 = ax.pcolormesh(
       -                        x, zpos_c, poros,
       -                        cmap=matplotlib.cm.get_cmap('Blues_r'),
       -                        #cmap=matplotlib.cm.get_cmap('bwr'),
       -                        #cmap=matplotlib.cm.get_cmap('coolwarm'),
       -                        #vmin=-p_ext, vmax=p_ext,
       -                        vmin=poros_min, vmax=poros_max,
       -                        rasterized=True)
       +                if cmap:
       +                    im1 = ax.pcolormesh(
       +                            x, zpos_c, poros,
       +                            cmap=cmap,
       +                            vmin=poros_min, vmax=poros_max,
       +                            rasterized=True)
       +                else:
       +                    im1 = ax.pcolormesh(
       +                            x, zpos_c, poros,
       +                            cmap=matplotlib.cm.get_cmap('Blues_r'),
       +                            #cmap=matplotlib.cm.get_cmap('bwr'),
       +                            #cmap=matplotlib.cm.get_cmap('coolwarm'),
       +                            #vmin=-p_ext, vmax=p_ext,
       +                            vmin=poros_min, vmax=poros_max,
       +                            rasterized=True)
                        ax.set_xlim([0, numpy.max(x)])
                        if sb.w_x[0] < sb.L[2]:
                            ax.set_ylim([zpos_c[0], sb.w_x[0]])