matplotlib 中的 colors 和 cmaps
1、matplotlib中的 148 种颜色
import matplotlib as plm
import matplotlib.pyplot as plt colors = plm.colors.cnames.keys() fig = plt.figure('百里希文', facecolor='lightyellow', edgecolor='k')
axes = fig.subplots(len(colors)//4, 4) for c, ax in zip(colors, axes.ravel()):
ax.hist(1, 3, color=c)
ax.text(1.2, 0.1, c)
ax.set_axis_off()
fig.subplots_adjust(left=0, bottom=0, right=0.9,
top=1, hspace=0.1, wspace=0.1)
fig.show()

2 matplotlib 中的 160 种颜色映射
import numpy as npimport matplotlib as plm
import matplotlib.pyplot as plt cmaps = plm.cm.cmap_d.keys()
gradient = np.linspace(0, 1, 256)
gradient = np.vstack((gradient, gradient)) fig = plt.figure('百里希文', facecolor='lightyellow', edgecolor='k')
axes = fig.subplots(len(cmaps)//5, 5) for cmap, ax in zip(cmaps, axes.ravel()):
ax.imshow(gradient, aspect='auto', cmap=plt.get_cmap(cmap))
ax.text(100, 1, cmap, fontsize=14)
ax.set_axis_off() fig.subplots_adjust(left=0.1, bottom=0, right=0.9,
top=1, hspace=0.1, wspace=0.1)
fig.show()

按语:
推荐几篇文章
https://cloud.tencent.com/developer/ask/136207/answer/241390
https://blog.csdn.net/Mr_Cat123/article/details/78638491
https://www.cnblogs.com/charliedaifu/p/9957822.html
https://blog.csdn.net/zhaogeng111/article/details/78419015
matplotlib 中的 colors 和 cmaps的更多相关文章
- 基于Python实现matplotlib中动态更新图片(交互式绘图)
最近在研究动态障碍物避障算法,在Python语言进行算法仿真时需要实时显示障碍物和运动物的当前位置和轨迹,利用Anaconda的Python打包集合,在Spyder中使用Python3.5语言和mat ...
- matplotlib中color可用的颜色
http://stackoverflow.com/questions/22408237/named-colors-in-matplotlib 参考网址给出了matplotlib中color可用的颜色: ...
- matplotlib中的颜色及线条控制
出自 http://www.cnblogs.com/darkknightzh/p/6117528.html 参考网址: http://stackoverflow.com/questions/22408 ...
- matplotlib中的legend()—显示图例
源自 matplotlib中的legend()——用于显示图例 -- 博客园 http://www.cnblogs.com/yinheyi/p/6792120.html legend()的一个用法: ...
- Matplotlib中中文不显示问题
我们在使用jupter进行数据分析的时候,会接触到Matplotlib这个库,它是用来进行可视化数据分析的,在一个图中,我们常常会加入一些中文来进行说明.当我们加入中文的时候会出现下图所示的样子: 可 ...
- python+NLTK 自然语言学习处理三:如何在nltk/matplotlib中的图片中显示中文
我们首先来加载我们自己的文本文件,并统计出排名前20的字符频率 if __name__=="__main__": corpus_root='/home/zhf/word' word ...
- Matplotlib中的颜色
使用matplotlib中会遇到选择颜色的问题,很多人会觉得自带的matlab风格的颜色不好看.好在Matplotlib已经预见到了这个问题,除了支持最基本的matlab传统颜色之外,还支持很多种颜色 ...
- 在values中添加colors.xml
如何在values中添加colors.xml文件?按钮上的文字,背景色的动态变化的xml放在res/drawable里,现在我就说静态的xml文件吧. res/values/colors.xml< ...
- 关于Matplotlib中No module named 'matplotlib.finance'的解决办法
最近在研究量化分析,需要用到matplotlib中的一个库,输入from matplotlib.finance import quotes_historical_yahoo_ohlc, candles ...
随机推荐
- luogu P2221 [HAOI2012]高速公路题解
题面 很套路的拆式子然后线段树上维护区间和的题.一般都是把式子拆成区间内几个形如\(\sum i*a_i, \sum i^2 * a_i\)的式子相加减的形式. 考虑一次询问[l,r]的答案怎么算: ...
- Linux性能优化实战学习笔记:第四十二讲
一.上节回顾 上一节,我们学习了 NAT 的原理,明白了如何在 Linux 中管理 NAT 规则.先来简单复习一下. NAT 技术能够重写 IP 数据包的源 IP 或目的 IP,所以普遍用来解决公网 ...
- [LeetCode] 17. Letter Combinations of a Phone Number 电话号码的字母组合
Given a string containing digits from 2-9inclusive, return all possible letter combinations that the ...
- 申请Github学生包(用学生证就行,免教育邮箱)
GitHub教育包的福利: 大名鼎鼎的JetBrains给学生教师的免费个人许可 https://education.github.com/pack/redeem/jetbrains 有Github学 ...
- Scala 准引用 - Quasiquote介绍
Quasiquotes are a neat notation that lets you manipulate Scala syntax trees with ease: scala> val ...
- LayUI-Table-添加禁止选中
LayUI这几年比较流行,里面的Table组件也比较强大,但是前面的CheckBox没有禁止选中功能,今天就来试试,看看能不能给添加一个禁止选中功能. Fork LayUI源码 LayUI项目地址 C ...
- html。PROGRESS进度条使用测试
效果图 : 代码: ----------------------------------- //本文来自:https://www.cnblogs.com/java2sap/p/11199126.htm ...
- Unity调用windows系统dialog 选择文件夹
#region 调用windows系统dialog 选择文件夹 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public ...
- 一个简单 System.Threading.Tasks.Dataflow.TransformBlock 示例
直接贴代码了: using System; using System.Collections.Generic; using System.IO; using System.Threading.Task ...
- WPF ResourceDictionary XAML资源 c#代码 获取与遍历
使用C#代码来获取XAML资源,除去正常的FindResource.而且是能查询到资源的对象. 说实话还是很麻烦的. 比如说我现在有一堆静态资源放在xaml的资源中,我想通过绑定的方式来获取. 好比是 ...