コード例 #1
0
    def OnCMapChanged(self, event):
        #print event.GetId()
        ind = self.cIds.index(event.GetId())

        cmn = event.GetString()
        if cmn == 'fastGrey':
            self.do.SetCMap(ind, fast_grey)

        elif cmn == 'labeled':
            self.do.SetCMap(ind, labeled)
        else:
            self.do.SetCMap(ind, cm.__getattribute__(cmn))
コード例 #2
0
ファイル: plots.py プロジェクト: etrautmann/jetpack
def lines(x, lines=None, cmap='viridis', **kwargs):
    if lines is None:
        lines = list(x)
        x = np.arange(len(lines[0]))

    else:
        lines = list(lines)

    colors = cm.__getattribute__(cmap)(np.linspace(0, 1, len(lines)))

    for line, color in zip(lines, colors):
        plt.plot(x, line, color=color)
コード例 #3
0
    def load_maps(self):
        """
        If it's necessary, loads matplotlib's color maps and adds them
        to the collection.

        EXAMPLES::

            sage: from sage.plot.colors import Colormaps
            sage: maps = Colormaps()
            sage: len(maps.maps)
            0
            sage: maps.load_maps()
            sage: len(maps.maps)>130
            True 
        """
        global cm
        if not cm:
            from matplotlib import cm
        if not self.maps:
            for cmap in cm.datad.keys():
                self.maps[cmap] = cm.__getattribute__(cmap)
コード例 #4
0
ファイル: colors.py プロジェクト: jwbober/sagelib
    def load_maps(self):
        """
        If it's necessary, loads matplotlib's color maps and adds them
        to the collection.

        EXAMPLES::

            sage: from sage.plot.colors import Colormaps
            sage: maps = Colormaps()
            sage: len(maps.maps)
            0
            sage: maps.load_maps()
            sage: len(maps.maps)>130
            True 
        """
        global cm
        if not cm:
            from matplotlib import cm
        if not self.maps:
            for cmap in cm.datad.keys():
                self.maps[cmap] = cm.__getattribute__(cmap)
コード例 #5
0
 #log.debug(input_file)
 csvfile = csv.reader(input_file)
 for i in csvfile:
     row = []
     for j in i:
         for width in range(graph_width):
             v = float(j)
             v = minv if minv and minv > v else v
             v = maxv if maxv and maxv < v else v
             row.append(v)
     for height in range(graph_height):
         data.append(row)
 fig, ax = plt.subplots(figsize=(canvas_width, canvas_height), dpi=10)
 cax = ax.imshow(data,
                 interpolation='nearest',
                 cmap=cm.__getattribute__(gtype))
 cur_path = os.path.dirname(__file__)
 prop = fm.FontProperties(fname=cur_path + '/static/fonts/ipag.ttf')
 ax.set_title(title, fontproperties=prop)
 # グラフ表示用のデータ生成
 _min = min([j for i in data for j in i])
 _max = max([j for i in data for j in i])
 _ave = (_min + _max) / 2.0
 log.debug("min = %d" % _min)
 log.debug("max = %d" % _max)
 log.debug("ave = %d" % _ave)
 ticks = [_min] + [
     _min + d * (_max - _min) / float(splitnum)
     for d in range(1, splitnum)
 ] + [_max]
 cbar = fig.colorbar(cax, ticks=ticks)
コード例 #6
0
ファイル: colors.py プロジェクト: vishalbelsare/jetpack
def cmap_colors(cmap, n, vmin=0, vmax=1):
  return cm.__getattribute__(cmap)(np.linspace(vmin, vmax, n))
コード例 #7
0
def colormap(cmapName):
    try:
        return cm.__getattribute__(cmapName)
    except:
        return cm.jet
コード例 #8
0
ファイル: views.py プロジェクト: cou/moon
        log.info("--start-- graph_generate")
        data = []
        #log.debug(input_file)
        csvfile = csv.reader(input_file)
        for i in csvfile:
            row = []
            for j in i:
                for width in range(graph_width):
                    v = float(j)
                    v = minv if minv and minv>v else v
                    v = maxv if maxv and maxv<v else v
                    row.append(v)
            for height in range(graph_height):
                data.append(row)
        fig, ax = plt.subplots(figsize=(canvas_width, canvas_height),dpi=10)
        cax = ax.imshow(data, interpolation='nearest', cmap=cm.__getattribute__(gtype))
        cur_path = os.path.dirname(__file__)
        prop = fm.FontProperties(fname=cur_path+'/static/fonts/ipag.ttf')
        ax.set_title(title, fontproperties=prop)
        # グラフ表示用のデータ生成
        _min = min([j for i in data for j in i ])
        _max = max([j for i in data for j in i])
        _ave = (_min+_max)/2.0
        log.debug("min = %d"%_min)
        log.debug("max = %d"%_max)
        log.debug("ave = %d"%_ave)
        ticks = [_min]+[_min+d*(_max-_min)/float(splitnum) for d in range(1,splitnum)]+[_max]
        cbar = fig.colorbar(cax, ticks=ticks)
        cbar.ax.set_yticklabels(['%.3f'%t for t in ticks])# vertically oriented colorbar

        imgdata = StringIO.StringIO()