官网:Choosing Colormaps in Matplotlib — Matplotlib 3.5.0 documentation

Colormap与matplotlib.cm

我们以等高区域函数contourf为例,介绍matplotlib.cm的用法。关于contourf各参数的具体用法,这里不多说,有需要可以参考Python:matplotlib.pyplot - ShineLe - 博客园

plt.contourf( X , Y , Z,...,cmap=? )

在用contourf绘制等值区域时,cmap参数指定了色表样式,它有两种写法——str或Colormap实例,举例来说:

plt.contourf( X , Y , Z,...,cmap='hot' )
#等价于
plt.contourf( X , Y , Z,...,cmap=matplotlib.cm.hot)

以上都是用同一个colormap进行等值区域绘制的,结果如下:

这就是colormap的用法。而matplotlib.cm中提供许多colormap,足够我们日常工作学习需要。

matplotlib.cm中的色表

官网:Colormap reference — Matplotlib 3.5.0 documentation

使用时,在需要填入colormap的地方,可以通过两种写法使用colormap,①字符串形式的色表名:'hot';②matplotlib.cm.色表名:matplotlib.cm.hot。

cm中的色表罗列如下:

Python:matplotlib.cm 色表的更多相关文章

  1. python+matplotlib 绘制等高线

    python+matplotlib 绘制等高线 步骤有七: 有一个m*n维的矩阵(data),其元素的值代表高度 构造两个向量:x(1*n)和y(1*m).这两个向量用来构造网格坐标矩阵(网格坐标矩阵 ...

  2. python matplotlib.pyplot 散点图详解(2)

    python matplotlib.pyplot 散点图详解(2) 上期资料 一.散点图叠加 可以用多个scatter函数叠加散点图 代码如下: import matplotlib.pyplot as ...

  3. python matplotlib 中文显示参数设置

    python matplotlib 中文显示参数设置 方法一:每次编写代码时进行参数设置 #coding:utf-8import matplotlib.pyplot as pltplt.rcParam ...

  4. python matplotlib plot 数据中的中文无法正常显示的解决办法

    转发自:http://blog.csdn.net/laoyaotask/article/details/22117745?utm_source=tuicool python matplotlib pl ...

  5. python matplotlib画图产生的Type 3 fonts字体没有嵌入问题

    ScholarOne's 对python matplotlib画图产生的Type 3 fonts字体不兼容,更改措施: 在程序中添加如下语句 import matplotlib matplotlib. ...

  6. 使用Python matplotlib做动态曲线

    今天看到“Python实时监控CPU使用率”的教程: https://www.w3cschool.cn/python3/python3-ja3d2z2g.html 自己也学习如何使用Python ma ...

  7. python matplotlib 中文显示乱码设置

    python matplotlib 中文显示乱码设置 原因:是matplotlib库中没有中文字体.1 解决方案:1.进入C:\Anaconda64\Lib\site-packages\matplot ...

  8. Python - matplotlib 数据可视化

    在许多实际问题中,经常要对给出的数据进行可视化,便于观察. 今天专门针对Python中的数据可视化模块--matplotlib这块内容系统的整理,方便查找使用. 本文来自于对<利用python进 ...

  9. 转:使用 python Matplotlib 库 绘图 及 相关问题

     使用 python Matplotlib 库绘图      转:http://blog.csdn.net/daniel_ustc/article/details/9714163 Matplotlib ...

随机推荐

  1. Mac中显示及隐藏文件和文件夹的方法

    一.方法一 直接在文件或文件夹名前面的加一个'.'点号,然后系统会弹出修改确认对话框,点好就行了. 隐藏文件 解除隐藏可以通过方法三显示所有隐藏文件,找到该文件去掉开头的'.',然后通过方法二来解除隐 ...

  2. 不难懂——CSS 匹配指定name元素

    <!doctype html> <html> <head> <meta charset="utf-8"> <meta name ...

  3. C++数据结构类型以及实现类

    1.array数组 #include<iostream> #include<array> using namespace std; int main() { array< ...

  4. python语法缩进

    1.python会根据缩进来判断代码行和前一句代码行之间的关系 2.for循环后一定要缩进,for循环后面的冒号代表告诉python,下面是代码行缩进的第一行

  5. Python 单元测试 实战演练

    结合实例,联系单元测试. 文件结构: |----Python_unittest |--------math_operation.py # 定义了类[class MathOperation:],类里面定 ...

  6. .NET 5.0 Docker 镜像 错误修复方法

    在给eshopondapr 打镜像的时候碰到了3个错误 1.restore: Received an unexpected EOF or 0 bytes from the transport stre ...

  7. django入门 01 创建项目

    安装django库 pip install django 创建--by 终端 django-admin startproject myproject 通过命令创建的django项目,默认不含templ ...

  8. bom-setInterval

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. Mac和Linux远程连接服务器异常修复(WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!)

    感谢大佬:https://blog.csdn.net/wd2014610/article/details/79945424 一.今天在使用SSH,连接远程服务器的时候,刚开始是没问题的. 后来阿里云主 ...

  10. 学习JDBC遇到的一些问题

    1. 数据库版本与驱动对应问题 参考官方文档:https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-versions.html 具体详情还需 ...