packages/vaex-core/vaex/legacy.py
def plot(self, grid=None, size=256, limits=None, square=False, center=None, weight=None, weight_stat="mean", figsize=None,
             aspect="auto", f="identity", axes=None, xlabel=None, ylabel=None,
             group_by=None, group_limits=None, group_colors='jet', group_labels=None, group_count=None,
             vmin=None, vmax=None,
             cmap="afmhot",
             **kwargs):
        """Plot the subspace using sane defaults to get a quick look at the data.

        :param grid: A 2d numpy array with the counts, if None it will be calculated using limits provided and Subspace.histogram
        :param size: Passed to Subspace.histogram
        :param limits: Limits for the subspace in the form [[xmin, xmax], [ymin, ymax]], if None it will be calculated using Subspace.limits_sigma
        :param square: argument passed to Subspace.limits_sigma
        :param Executor executor: responsible for executing the tasks
        :param figsize: (x, y) tuple passed to pylab.figure for setting the figure size
        :param aspect: Passed to matplotlib's axes.set_aspect
        :param xlabel: String for label on x axis (may contain latex)
        :param ylabel: Same for y axis
        :param kwargs: extra argument passed to axes.imshow, useful for setting the colormap for instance, e.g. cmap='afmhot'
        :return: matplotlib.image.AxesImage

         """
        import pylab
        f = _parse_f(f)
        limits = self.limits(limits)
        if limits is None:
            limits = self.limits_sigma()
        # if grid is None:
        if group_limits is None and group_by:
            group_limits = tuple(self.df(group_by).minmax()[0]) + (group_count,)
        # grid = self.histogram(limits=limits, size=size, weight=weight, group_limits=group_limits, group_by=group_by)
        if figsize is not None:
            pylab.figure(num=None, figsize=figsize, dpi=80, facecolor='w', edgecolor='k')
        if axes is None:
            axes = pylab.gca()
        fig = pylab.gcf()
        # if xlabel:
        pylab.xlabel(xlabel or self.expressions[0])
        # if ylabel:
        pylab.ylabel(ylabel or self.expressions[1])
        # axes.set_aspect(aspect)
        rgba8 = self.image_rgba(grid=grid, size=size, limits=limits, square=square, center=center, weight=weight, weight_stat=weight_stat,
                                f=f, axes=axes,
                                group_by=group_by, group_limits=group_limits, group_colors=group_colors, group_count=group_count,
                                vmin=vmin, vmax=vmax,
                                cmap=cmap)
        import matplotlib
        if group_by:
            if isinstance(group_colors, six.string_types):
                group_colors = matplotlib.cm.get_cmap(group_colors)
            if isinstance(group_colors, matplotlib.colors.Colormap):
                group_count = group_limits[2]
                colors = [group_colors(k / float(group_count - 1.)) for k in range(group_count)]
            else:
                colors = [matplotlib.colors.colorConverter.to_rgba(k) for k in group_colors]
            colormap = matplotlib.colors.ListedColormap(colors)
            gmin, gmax, group_count = group_limits  # [:2]
            delta = (gmax - gmin) / (group_count - 1.)
            norm = matplotlib.colors.Normalize(gmin - delta / 2, gmax + delta / 2)
            sm = matplotlib.cm.ScalarMappable(norm, colormap)
            sm.set_array(1)  # make matplotlib happy (strange behavious)
            colorbar = fig.colorbar(sm)
            if group_labels:
                colorbar.set_ticks(np.arange(gmin, gmax + delta / 2, delta))
                colorbar.set_ticklabels(group_labels)
            else:
                colorbar.set_ticks(np.arange(gmin, gmax + delta / 2, delta))
                colorbar.set_ticklabels(map(lambda x: "%f" % x, np.arange(gmin, gmax + delta / 2, delta)))
            colorbar.ax.set_ylabel(group_by)
            # matplotlib.colorbar.ColorbarBase(axes, norm=norm, cmap=colormap)
            im = axes.imshow(rgba8, extent=np.array(limits).flatten(), origin="lower", aspect=aspect, **kwargs)
        else:
            norm = matplotlib.colors.Normalize(0, 23)
            sm = matplotlib.cm.ScalarMappable(norm, cmap)
            sm.set_array(1)  # make matplotlib happy (strange behavious)
            colorbar = fig.colorbar(sm)
            im = axes.imshow(rgba8, extent=np.array(limits).flatten(), origin="lower", aspect=aspect, **kwargs)
            colorbar = None
        return im, colorbar
def plot(self, grid=None, size=256, limits=None, square=False, center=None, weight=None, weight_stat="mean", figsize=None,
             aspect="auto", f="identity", axes=None, xlabel=None, ylabel=None,
             group_by=None, group_limits=None, group_colors='jet', group_labels=None, group_count=None,
             vmin=None, vmax=None,
             cmap="afmhot",
             **kwargs):
        """Plot the subspace using sane defaults to get a quick look at the data.

        :param grid: A 2d numpy array with the counts, if None it will be calculated using limits provided and Subspace.histogram
        :param size: Passed to Subspace.histogram
        :param limits: Limits for the subspace in the form [[xmin, xmax], [ymin, ymax]], if None it will be calculated using Subspace.limits_sigma
        :param square: argument passed to Subspace.limits_sigma
        :param Executor executor: responsible for executing the tasks
        :param figsize: (x, y) tuple passed to pylab.figure for setting the figure size
        :param aspect: Passed to matplotlib's axes.set_aspect
        :param xlabel: String for label on x axis (may contain latex)
        :param ylabel: Same for y axis
        :param kwargs: extra argument passed to axes.imshow, useful for setting the colormap for instance, e.g. cmap='afmhot'
        :return: matplotlib.image.AxesImage

         """
        import pylab
        f = _parse_f(f)
        limits = self.limits(limits)
        if limits is None:
            limits = self.limits_sigma()
        # if grid is None:
        if group_limits is None and group_by:
            group_limits = tuple(self.df(group_by).minmax()[0]) + (group_count,)
        # grid = self.histogram(limits=limits, size=size, weight=weight, group_limits=group_limits, group_by=group_by)
        if figsize is not None:
            pylab.figure(num=None, figsize=figsize, dpi=80, facecolor='w', edgecolor='k')
        if axes is None:
            axes = pylab.gca()
        fig = pylab.gcf()
        # if xlabel:
        pylab.xlabel(xlabel or self.expressions[0])
        # if ylabel:
        pylab.ylabel(ylabel or self.expressions[1])
        # axes.set_aspect(aspect)
        rgba8 = self.image_rgba(grid=grid, size=size, limits=limits, square=square, center=center, weight=weight, weight_stat=weight_stat,
                                f=f, axes=axes,
                                group_by=group_by, group_limits=group_limits, group_colors=group_colors, group_count=group_count,
                                vmin=vmin, vmax=vmax,
                                cmap=cmap)
        import matplotlib
        if group_by:
            if isinstance(group_colors, six.string_types):
                group_colors = matplotlib.cm.get_cmap(group_colors)
            if isinstance(group_colors, matplotlib.colors.Colormap):
                group_count = group_limits[2]
                colors = [group_colors(k / float(group_count - 1.)) for k in range(group_count)]
            else:
                colors = [matplotlib.colors.colorConverter.to_rgba(k) for k in group_colors]
            colormap = matplotlib.colors.ListedColormap(colors)
            gmin, gmax, group_count = group_limits  # [:2]
            delta = (gmax - gmin) / (group_count - 1.)
            norm = matplotlib.colors.Normalize(gmin - delta / 2, gmax + delta / 2)
            sm = matplotlib.cm.ScalarMappable(norm, colormap)
            sm.set_array(1)  # make matplotlib happy (strange behavious)
            colorbar = fig.colorbar(sm)
            if group_labels:
                colorbar.set_ticks(np.arange(gmin, gmax + delta / 2, delta))
                colorbar.set_ticklabels(group_labels)
            else:
                colorbar.set_ticks(np.arange(gmin, gmax + delta / 2, delta))
                colorbar.set_ticklabels(map(lambda x: "%f" % x, np.arange(gmin, gmax + delta / 2, delta)))
            colorbar.ax.set_ylabel(group_by)
            # matplotlib.colorbar.ColorbarBase(axes, norm=norm, cmap=colormap)
            im = axes.imshow(rgba8, extent=np.array(limits).flatten(), origin="lower", aspect=aspect, **kwargs)
        else:
            norm = matplotlib.colors.Normalize(0, 23)
            sm = matplotlib.cm.ScalarMappable(norm, cmap)
            sm.set_array(1)  # make matplotlib happy (strange behavious)
            colorbar = fig.colorbar(sm)
            im = axes.imshow(rgba8, extent=np.array(limits).flatten(), origin="lower", aspect=aspect, **kwargs)
            colorbar = None
        return im, colorbar
def plot ( self , grid = None , size = 256 , limits = None , square = False , center = None , weight = None , weight_stat = "mean" , figsize = None , aspect = "auto" , f = "identity" , axes = None , xlabel = None , ylabel = None , group_by = None , group_limits = None , group_colors = 'jet' , group_labels = None , group_count = None , vmin = None , vmax = None , cmap = "afmhot" , * * kwargs ) : import pylab f = _parse_f ( f ) limits = self . limits ( limits ) if limits is None : limits = self . limits_sigma ( ) # if grid is None: if group_limits is None and group_by : group_limits = tuple ( self . df ( group_by ) . minmax ( ) [ 0 ] ) + ( group_count , ) # grid = self.histogram(limits=limits, size=size, weight=weight, group_limits=group_limits, group_by=group_by) if figsize is not None : pylab . figure ( num = None , figsize = figsize , dpi = 80 , facecolor = 'w' , edgecolor = 'k' ) if axes is None : axes = pylab . gca ( ) fig = pylab . gcf ( ) # if xlabel: pylab . xlabel ( xlabel or self . expressions [ 0 ] ) # if ylabel: pylab . ylabel ( ylabel or self . expressions [ 1 ] ) # axes.set_aspect(aspect) rgba8 = self . image_rgba ( grid = grid , size = size , limits = limits , square = square , center = center , weight = weight , weight_stat = weight_stat , f = f , axes = axes , group_by = group_by , group_limits = group_limits , group_colors = group_colors , group_count = group_count , vmin = vmin , vmax = vmax , cmap = cmap ) import matplotlib if group_by : if isinstance ( group_colors , six . string_types ) : group_colors = matplotlib . cm . get_cmap ( group_colors ) if isinstance ( group_colors , matplotlib . colors . Colormap ) : group_count = group_limits [ 2 ] colors = [ group_colors ( k / float ( group_count - 1. ) ) for k in range ( group_count ) ] else : colors = [ matplotlib . colors . colorConverter . to_rgba ( k ) for k in group_colors ] colormap = matplotlib . colors . ListedColormap ( colors ) gmin , gmax , group_count = group_limits # [:2] delta = ( gmax - gmin ) / ( group_count - 1. ) norm = matplotlib . colors . Normalize ( gmin - delta / 2 , gmax + delta / 2 ) sm = matplotlib . cm . ScalarMappable ( norm , colormap ) sm . set_array ( 1 ) # make matplotlib happy (strange behavious) colorbar = fig . colorbar ( sm ) if group_labels : colorbar . set_ticks ( np . arange ( gmin , gmax + delta / 2 , delta ) ) colorbar . set_ticklabels ( group_labels ) else : colorbar . set_ticks ( np . arange ( gmin , gmax + delta / 2 , delta ) ) colorbar . set_ticklabels ( map ( lambda x : "%f" % x , np . arange ( gmin , gmax + delta / 2 , delta ) ) ) colorbar . ax . set_ylabel ( group_by ) # matplotlib.colorbar.ColorbarBase(axes, norm=norm, cmap=colormap) im = axes . imshow ( rgba8 , extent = np . array ( limits ) . flatten ( ) , origin = "lower" , aspect = aspect , * * kwargs ) else : norm = matplotlib . colors . Normalize ( 0 , 23 ) sm = matplotlib . cm . ScalarMappable ( norm , cmap ) sm . set_array ( 1 ) # make matplotlib happy (strange behavious) colorbar = fig . colorbar ( sm ) im = axes . imshow ( rgba8 , extent = np . array ( limits ) . flatten ( ) , origin = "lower" , aspect = aspect , * * kwargs ) colorbar = None return im , colorbar
Plot the subspace using sane defaults to get a quick look at the data.

        :param grid: A 2d numpy array with the counts, if None it will be calculated using limits provided and Subspace.histogram
        :param size: Passed to Subspace.histogram
        :param limits: Limits for the subspace in the form [[xmin, xmax], [ymin, ymax]], if None it will be calculated using Subspace.limits_sigma
        :param square: argument passed to Subspace.limits_sigma
        :param Executor executor: responsible for executing the tasks
        :param figsize: (x, y) tuple passed to pylab.figure for setting the figure size
        :param aspect: Passed to matplotlib's axes.set_aspect
        :param xlabel: String for label on x axis (may contain latex)
        :param ylabel: Same for y axis
        :param kwargs: extra argument passed to axes.imshow, useful for setting the colormap for instance, e.g. cmap='afmhot'
        :return: matplotlib.image.AxesImage
Plot the subspace using sane defaults to get a quick look at the data .