我是靠谱客的博主 柔弱蜜粉,这篇文章主要介绍stackplot,现在分享给大家,希望可以做个参考。

# -*- coding: utf-8 -*-
"""
Created on Tue Nov 04 15:46:32 2014
@author: dell
"""
import numpy as np
import matplotlib.pyplot as plt
if __name__ == '__main__':
mylist = [np.random.uniform(30, 50, 100) for i in range(3)]
#mylist = [np.random.randint(30, 50, 100) for i in range(3)]
y = np.row_stack(mylist)
x = range(0, 100)
fig = plt.figure()
ax1 = fig.add_subplot(311)
ax1.stackplot(x, y)
#plt.show()

ax2 = fig.add_subplot(312)
ax2.plot(x,mylist[0], '-.')
ax2.plot(x,sum(mylist[0:2]), '--')
ax2.plot(x,sum(mylist[0:3]), ':')
ax3 = fig.add_subplot(313)
ax3.stackplot(x, y)
y_stack = np.cumsum(y, axis=0)
ax3.fill_between(x, 0, y_stack[0,:], facecolor="#CC6666", alpha=.7)
ax3.fill_between(x, y_stack[0,:], y_stack[1,:], facecolor="#1DACD6", alpha=.7)
ax3.fill_between(x, y_stack[1,:], y_stack[2,:], facecolor="#6E5160")
plt.show()

转载于:https://www.cnblogs.com/hluo/p/4074343.html

最后

以上就是柔弱蜜粉最近收集整理的关于stackplot的全部内容,更多相关stackplot内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(120)

评论列表共有 0 条评论

立即
投稿
返回
顶部