python matplotlib包图像配色方案分享

可选的配色方案:

Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r, Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r, PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r, PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r, Wistia, Wistia_r, YlGn, YlGnBu, YlGnBu_r, YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r, afmhot, afmhot_r, autumn, autumn_r, binary, binary_r, bone, bone_r, brg, brg_r, bwr, bwr_r, cividis, cividis_r, cool, cool_r, coolwarm, coolwarm_r, copper, copper_r, cubehelix, cubehelix_r, flag, flag_r, gist_earth, gist_earth_r, gist_gray, gist_gray_r, gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow, gist_rainbow_r, gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gnuplot, gnuplot2, gnuplot2_r, gnuplot_r, gray, gray_r, hot, hot_r, hsv, hsv_r, inferno, inferno_r, jet, jet_r, magma, magma_r, nipy_spectral, nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, seismic, seismic_r, spring, spring_r, summer, summer_r, tab10, tab10_r, tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r, viridis, viridis_r, winter, winter_r

RGB对照表:https://www.114la.com/other/rgb.htm

常用的几个:

示例代码:

cm='Spectral'  #hot bone cool copper gray hsv inferno jet magma pink plasma summer viridis bwr ocean rainbow coolwarm Spectral......................
norm = matplotlib.colors.Normalize(vmin=min, vmax=max)
map=plt.imshow(plt_arr,interpolation='nearest',cmap=cm,norm=norm, origin='upper') # plt_arr是要显示的数据
mydpi=1000
plt.savefig("filename.png", dpi=mydpi ,bbox_inches='tight', pad_inches=0) # ,bbox_inches='tight' less white area
plt.show()

图像实例:

hsv

hot

cool

rainbow

gist_earth

以上这篇python matplotlib包图像配色方案分享就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持我们。

(0)

相关推荐

  • Python Matplotlib库安装与基本作图示例

    本文实例讲述了Python Matplotlib库安装与基本作图.分享给大家供大家参考,具体如下: 不论是数据挖掘还是数据建模,都免不了数据可视化的问题.对于Python来说,Matplotlib是著名的绘图库,它主要用于二维绘图,简单的三维绘图. 安装Matplotlib 通过pip安装Matplotlib步骤: 在cmd窗口下,进入到pip安装目录,在命令提示符中依次输入 python -m pip install -U pip setuptools python -m pip instal

  • python实现图像拼接

    本文实例为大家分享了python实现图像拼接的具体代码,供大家参考,具体内容如下 1.待拼接的图像 2. 基于SIFT特征点和RANSAC方法得到的图像特征点匹配结果 3.图像变换结果 4.代码及注意事项 import cv2 import numpy as np def cv_show(name, image): cv2.imshow(name, image) cv2.waitKey(0) cv2.destroyAllWindows() def detectAndCompute(image):

  • matplotlib实现显示伪彩色图像及色度条

    灰度图显示为伪彩色图 法一 import matplotlib.pyplot as plt img = plt.imread('C:/Users/leex/Desktop/lena.jpg') img_s = img[:,:,0]# 直接读入的img为3通道,这里用直接赋值的方法转为单通道 sc = plt.imshow(img_s) sc.set_cmap('hot')# 这里可以设置多种模式 plt.colorbar()# 显示色度条 效果 限制范围 import matplotlib.py

  • python matplotlib包图像配色方案分享

    可选的配色方案: Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r, Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_

  • Python matplotlib包和gif包生成gif动画实战对比

    目录 前言 gif包概述 动画原理 gif包解读 options类 frames函数 save函数 gif包生成gif动画实践 以心形曲线为例比较gif包和animation模块实现动画的差异 gif包的实现方式 比较结果 总结 前言 使用matplotlib生成gif动画的方法有很多,一般常规使用matplotlib的animation模块的FuncAnimation函数实现. 在matplotlib官网看到了第三方动画包gif的介绍. gif包概述 gif包是支持 Altair, matpl

  • Python+Matplotlib绘制3D图像的示例详解

    目录 1. 绘制3D柱状图 2. 绘制3D曲面图 示例1 示例2 3.绘制3D散点图 4. 绘制3D曲线图 1. 绘制3D柱状图 绘制3D柱状图使用的是axes3d.bar()方法. 可能跟我们中学学的有一点不同的是,其语法如下: bar(left, height, zs=0, zdir=‘z’, *args, **kwargs) 其中left表示指向侧边的轴,zs表示指向我们的方向的轴,height即表示高度的轴.这三者都需要是一维的序列对象.在调用相关方法的时候,比如设置轴标签,还有一点需要

  • Python matplotlib绘图时指定图像大小及放大图像详解

    matplotlib绘图时是默认的大小,有时候默认的大小会感觉图片里的内容都被压缩了,解决方法如下. 先是原始代码: from matplotlib import pyplot as plt plt.figure(figsize=(1,1)) x = [1,2,3] plt.plot(x, x) plt.show() 关键的代码是plt.figure(figsize=(1,1)),生成的图片如下 修改代码,放大图片: from matplotlib import pyplot as plt pl

  • python matplotlib画图实例代码分享

    python的matplotlib包支持我们画图,有点非常多,现学习如下. 首先要导入包,在以后的示例中默认已经导入这两个包 import matplotlib.pyplot as plt import numpy as np 然后画一个最基本的图 t = np.arange(0.0, 2.0, 0.01)#x轴上的点,0到2之间以0.01为间隔 s = np.sin(2*np.pi*t)#y轴为正弦 plt.plot(t, s)#画图 plt.xlabel('time (s)')#x轴标签 p

  • python/Matplotlib绘制复变函数图像教程

    今天发现sympy依赖的库mpmath里也有很多数学函数,其中也有在复平面绘制二维图的函数cplot,具体例子如下 from mpmath import * def f1(z): return z def f2(z): return z**3 def f3(z): return (z**4-1)**(1/4) def f4(z): return 1/z def f5(z): return atan(z) def f6(z): return sqrt(z) cplot(f1) cplot(f2)

  • 通过python的matplotlib包将Tensorflow数据进行可视化的方法

    使用matplotlib中的一些函数将tensorflow中的数据可视化,更加便于分析 import tensorflow as tf import numpy as np import matplotlib.pyplot as plt def add_layer(inputs, in_size, out_size, activation_function=None): Weights = tf.Variable(tf.random_normal([in_size, out_size])) bi

  • python读取dicom图像示例(SimpleITK和dicom包实现)

    1. 用SimpleITK读取dicom序列: import SimpleITK as sitk import numpy as np img_path='F:\\dataset\\pancreas\\Output\\thick\\original\\1' mask_path='F:\\dataset\\pancreas\\Output\\thick\\groundtruth\\1' reader = sitk.ImageSeriesReader() img_names = reader.Get

  • Python matplotlib画图时图例说明(legend)放到图像外侧详解

    用python的matplotlib画图时,往往需要加图例说明.如果不设置任何参数,默认是加到图像的内侧的最佳位置. import matplotlib.pyplot as plt import numpy as np x = np.arange(10) fig = plt.figure() ax = plt.subplot(111) for i in xrange(5): ax.plot(x, i * x, label='$y = %ix$' % i) plt.legend() plt.sho

  • Python+Matplotlib绘制双y轴图像的示例代码

    目录 双Y轴图简介 实现思路 实现代码 样式一 样式二 双Y轴图简介 双Y轴图顾名思义就是在一个图里有两个Y轴.这种图形主要用来展示两个因变量和一个自变量的关系并且两个因变量的数值单位还不同.如我们想要展示不同月份公司销业绩以及成本的变化情况这时就可以用双Y轴图来展示.(因变量销量和成本具有不同的单位). 实现思路 绘制双y轴的思想,也是用到了matplotlib面向对象绘图的思想.在不指定位置的情况下,在一个画布上创建出两个坐标系,其中第一个坐标系正常创建,第二个坐标系则使用专有的twinx(

随机推荐