当前位置: 首页>>代码示例>>Python>>正文


Python pyplot.colormaps方法代码示例

本文整理汇总了Python中matplotlib.pyplot.colormaps方法的典型用法代码示例。如果您正苦于以下问题:Python pyplot.colormaps方法的具体用法?Python pyplot.colormaps怎么用?Python pyplot.colormaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.pyplot的用法示例。


在下文中一共展示了pyplot.colormaps方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import colormaps [as 别名]
def __init__(self, value: str):
        """ initialize with a color """
        super().__init__(value)
        import matplotlib.pyplot as plt
        self.maps = plt.colormaps()
        self.setAcceptDrops(True)
        self.setAlignment(QtCore.Qt.AlignHCenter)
        self.setColor(value, True) 
开发者ID:rgerum,项目名称:pylustrator,代码行数:10,代码来源:QtShortCuts.py

示例2: figureSwapColor

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import colormaps [as 别名]
def figureSwapColor(figure: Figure, new_color: str, color_base: str):
    """ swap two colors of a figure """
    if getattr(figure, "color_artists", None) is None:
        figureListColors(figure)
    changed_cmaps = []
    maps = plt.colormaps()
    for data in figure.color_artists[color_base]:
        # get the data
        color_type_name, artist, value, cmap, index = data
        # if the color is part of a colormap, update the colormap
        if cmap:
            # update colormap
            if cmap not in changed_cmaps:
                changed_cmaps.append(cmap)
                if getattr(cmap, "set_color", None) is not None:
                    cmap.set_color(new_color, index)
            if getattr(cmap, "set_color", None) is None:
                if new_color in maps:
                    cmap = plt.get_cmap(new_color)
                else:
                    getattr(artist, "set_" + color_type_name)(new_color)
                    artist.figure.change_tracker.addChange(artist,
                                                           ".set_" + color_type_name + "(\"%s\")" % (new_color,))
                    continue
            # use the attributes setter method
            getattr(artist, "set_" + color_type_name)(cmap(value))
            artist.figure.change_tracker.addChange(artist, ".set_" + color_type_name + "(plt.get_cmap(\"%s\")(%s))" % (
            cmap.name, str(value)))
        else:
            if new_color in maps:
                cmap = plt.get_cmap(new_color)
                getattr(artist, "set_" + color_type_name)(cmap(0))
                artist.figure.change_tracker.addChange(artist,
                                                       ".set_" + color_type_name + "(plt.get_cmap(\"%s\")(%s))" % (
                                                           cmap.name, str(0)))
            else:
                # use the attributes setter method
                getattr(artist, "set_" + color_type_name)(new_color)
                artist.figure.change_tracker.addChange(artist, ".set_" + color_type_name + "(\"%s\")" % (new_color,)) 
开发者ID:rgerum,项目名称:pylustrator,代码行数:41,代码来源:QtGui.py

示例3: colors_changed

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import colormaps [as 别名]
def colors_changed(self):
        """ when the colors changed """
        if self.trigger_no_update:
            return
        maps = plt.colormaps()
        # when the colors in the text edit changed
        for index, color in enumerate(self.colors_text_widget.toPlainText().split("\n")):
            try:
                color = mpl.colors.to_hex(color.strip())
            except ValueError:
                if color not in maps:
                    continue
            if len(self.color_buttons_list) <= index:
                self.addColorButton(color)
            self.color_buttons_list[index].setColor(color) 
开发者ID:rgerum,项目名称:pylustrator,代码行数:17,代码来源:QtGui.py

示例4: paint_surface

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import colormaps [as 别名]
def paint_surface(lowthresh, highthres, color_scheme, data_array, save_colorbar = True):
	colormaps = np.array(plt.colormaps(),dtype=np.str)
	if (str(color_scheme) == 'r_y') or (str(color_scheme) == 'red-yellow'):
		out_color_array = convert_redtoyellow(np.array((float(lowthresh),float(highthres))), data_array, save_colorbar = save_colorbar)
	elif (str(color_scheme) == 'b_lb') or (str(color_scheme) == 'blue-lightblue'):
		out_color_array = convert_bluetolightblue(np.array((float(lowthresh),float(highthres))), data_array, save_colorbar = save_colorbar)
	elif np.any(colormaps == str(color_scheme)):
		out_color_array = convert_mpl_colormaps(np.array((float(lowthresh),float(highthres))), data_array, str(color_scheme), save_colorbar = save_colorbar)
	else:
		print("Error: colour scheme %s does not exist" % str(color_scheme))
		quit()
	return out_color_array


# strips basename 
开发者ID:trislett,项目名称:TFCE_mediation,代码行数:17,代码来源:tm_func.py


注:本文中的matplotlib.pyplot.colormaps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。