Matplotlib -多组线用不同的线性、颜色、节点绘制
来源:互联网 发布:什么软件是写小说的 编辑:程序博客网 时间:2024/06/05 22:32
Matplotlib -多组线用不同的线性、颜色、节点绘制
先来看看我们要实现的效果图吧:
先来看看Matplotlib的plot函数原型
plt.plot(x, y, color=’r’, maker=’o’, linestyle=’-‘, linewidth=2.0)
注意上面的color、maker、linestyle在同时画多组线的时候,我们想调线性、颜色的时候,你估计会想到用个列表的形式实现:
maker=[‘o’, ‘^’, ‘*’]
可惜,plot函数并没有实现这个功能,只能一次次指定,这里可以借助python的itertools迭代实现,还是以我上面的图作为例子,看看是怎么实现的吧。
make = itertools.cycle([“o”,”*”,”^”])
for i in [2013, 2014, 2015]:
axf.plot(axe.get_xticks(), right_data[i], linestyle=’-‘, marker=make.next(), linewidth=2.0)
注意:参考4实现这个方法使用zip,以后可以注意下。
参考
http://matplotlib.org/users/pyplot_tutorial.html#controlling-line-properties
http://stackoverflow.com/questions/29163096/matplotlib-different-dashed-lines-instead-of-coloured-lines
http://stackoverflow.com/questions/23000578/cycling-through-list-of-linestyles-when-plotting-columns-of-a-matrix-in-matplotl
http://stackoverflow.com/questions/33523476/matplotlib-plot-columns-of-pandas-dataframe-with-different-marker-and-label
- Matplotlib -多组线用不同的线性、颜色、节点绘制
- 使用Matplotlib文本注解绘制树节点
- 绘制带线性颜色变化填充的折线图
- ListBox中,用不同的颜色绘制一行文字
- iOS 界面上绘制不同字体 颜色 大小的字符串
- matplotlib绘制动画的示例
- matplotlib-绘制精美的图表
- matplotlib-绘制精美的图表
- matplotlib绘制动画的示例
- matplotlib-绘制精美的图表
- python matplotlib 方程的绘制
- matplotlib-绘制精美的图表
- matplotlib-绘制精美的图表
- matplotlib-绘制精美的图表
- matplotlib-绘制精美的图表
- python matplotlib图像的绘制
- matplotlib-绘制精美的图表
- matplotlib绘制余弦的散点图
- 详细介绍 Python-__builtin__与__builtins__和builtins的区别与关系
- appstore开发者 名称修改
- 实时显示textarea输入多少字
- list的remove方法中的陷阱
- Makefile-例程讲解
- Matplotlib -多组线用不同的线性、颜色、节点绘制
- Android-- 隐藏显示软键盘
- cocos-js的一些问题
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- 学习编程常用网址
- asp.net mvc5中使用缓存依赖SqlCacheDependency
- js中substr,substring,indexOf,lastIndexOf,split 的用法
- eclipse springsource-tool-suite相关问题
- 双栈排序