从matplotlib>=1.5.0开始,一种方法是调用higher-level ^{} getter function,而不是直接访问低级数据结构(例如matplotlib.cm.cmap_d,matplotlib.cm.datad)。

调用matplotlib.pyplot.colormaps()具有隐式排序所有返回颜色映射的名称(按字典顺序)的优点。由于matplotlib.cm.cmap_d目前是作为一个标准的无序字典来实现的,因此打印或迭代其键(如ImportanceOfBeingErnest's answer)有点麻烦:例如# The pyplot.colormap() approach (works with matplotlib >= 1.5.0 ).

>>> import matplotlib.pyplot as plt

>>> print(plt.colormaps())

['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']

# The direct matplotlib.cm approach (also works with matplotlib < 1.5.0)

>>> import matplotlib.cm

>>> print(matplotlib.cm.cmap_d.keys())

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

你好!Sane API+人类可读性=很好。

plt python 自己制定cmap_在plt.cm.get-cmap中可以使用哪些名称?相关推荐

  1. plt python 自己制定cmap_带有自定义cmap颜色的matplotlib散点图不正确

    所以我按照一个模式为我的散点图创建一个自定义的颜色图和cbar.我创建了4个子图,每个子图覆盖了一个参数的不同范围,这个参数用来给点颜色.此参数的值范围从1e-10到1.0.在 我做以下工作:cmap ...

  2. Python混淆矩阵可视化:plt.colorbar函数自定义颜色条的数值标签、配置不同情况下颜色条的数值范围以及数据类型(整型、浮点型)

    Python混淆矩阵可视化:plt.colorbar函数自定义颜色条的数值标签.配置不同情况下颜色条的数值范围以及数据类型(整型.浮点型) 目录

  3. python 可视化:fig, ax = plt.subplots()画多表图的3中常见样例 自定义图表格式

    目录 一.fig, ax = plt.subplots()的作用? 二.参数的含义? 三.怎么在一个图上排列多个子图? 四.怎么把多个子图一起合并到一个图上? <Python for Data ...

  4. python打印特殊符号_python plt可视化——打印特殊符号和制作图例代码

    1.打印特殊符号 matplotlib在公式书写上面跟latex很相似,接下来我们就特殊符号,上标下标来具体展示一下.import matplotlib.pyplot as plt x = [i+1 ...

  5. python图像处理基础知识(plt库函数说明)

    python图像处理基础知识,plt库函数说明 目录 python图像处理基础知识,plt库函数说明 1.画图(plt库) 1.1 plt.figure(num='',figsize=(x, y),d ...

  6. 【python matplotlib 】fig, ax = plt.subplots()画多表图

    文章目录 一. fig, ax = plt.subplots()的作用 二.参数的含义 三.图上排列多个子图 四.把多个子图一起合并到一个图上 五.画图刻度.图例等字体.字体大小.刻度密度.线条样式设 ...

  7. Python深度学习入门之plt画图工具基础使用(注释详细,超级简单)

    Python自带的plt是深度学习最常用的库之一,在发表文章时必然得有图作为支撑,plt为深度学习必备技能之一.作为深度学习入门,只需要掌握一些基础画图操作即可,其他等要用到的时候看看函数API就行. ...

  8. python plt画图_【Python】 【绘图】plt.figure()的使用

    1.figure语法及操作 (1)figure语法说明 figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, ...

  9. 【Python知识】可视化函数plt.scatter

    目录 一.说明 二.函数和参数详解 2.1 scatter函数原型 2.2 参数详解 2.3 其中散点的形状参数marker如下: 2.4 其中颜色参数c如下: 三.画图示例 3.1 关于坐标x,y和 ...

最新文章

  1. Linux 常用命令标记
  2. 解决SpringBoot更新数据到MySQL乱码问题
  3. OperationalError: (1044, Access denied for user ''@'localhost' to database 'mydb')
  4. 独立开发人员的自由之路 ——1
  5. 关于MSSQL数据存储的问题
  6. linux的进程pcd,LINUX下查看点云图————point cloud(.ply .vtk .pcd)
  7. Linux时间子系统(十六) clockevent
  8. 使用ActivityGroup类显示多个Activity
  9. Photoshop插件-加深减淡中灰图-脚本开发-PS插件
  10. vs使用安装devexpress教程
  11. FreeCAD 乐高积木
  12. django获取cleaned_data属性失败
  13. 联想拯救者笔记本电脑亮度无法调节解决办法
  14. Unity显示360度全景照片
  15. 关于AE动画文件如何导出 cocos-creater所需的序列帧动画的方法
  16. 在Termux中安装Kali教程
  17. 计算机磁盘网络怎么共享,手机怎么访问电脑共享磁盘
  18. 短视频开发SDK 架构设计实践
  19. 图像处理总结2、图像增强
  20. 解决!Google Play 设备未获得Play保护机制认证

热门文章

  1. Hypermesh-laminate复合材料案例学习笔记
  2. javaScript函数的定义和arguments,result关键字
  3. C++ 文件的随机读写
  4. 通过命令行运行matlab代码
  5. 原神振晶的研究第五天该怎么过 振晶的研究第五天通关攻略
  6. 苹果电脑删除自带软件
  7. 国内外主要搜索引擎登录入口
  8. hihoCoder #1558 : H国的身份证号码I
  9. 一个简单的用Perl实现的Exploit实例
  10. 如何把e01挂载到系统上?