matplotlib
xd96dx
这个作者很懒,什么都没留下…
展开
-
matplatlib实例三 水平条形图
先瞅代码 fig, ax = plt.subplots() ax.barh(1, 10, xerr=0.3, align='center') ax.barh(2, 5,) ax.barh(3, 8,) ax.set_yticks([1, 2, 3]) ax.set_yticklabels(["blue", "yellow", "green"]) ax.invert_yaxis() # y轴顺序翻转 ax.set_title("11") plt.show()原创 2020-08-20 21:52:23 · 120 阅读 · 0 评论 -
matplatlib实例二 分组柱状图
label = ["A", "B", "C"] num1 = [10, 20, 16] num2 = [15, 10, 25] x = np.arange(len(label)) fig, ax = plt.subplots() r1 = ax.bar(x-0.3/2, num1, 0.3, label="num1") r2 = ax.bar(x+0.3/2, num2, 0.3, label="num2") ax.set_xticks([0, 1, 2]) # list of location原创 2020-08-17 19:36:37 · 214 阅读 · 0 评论 -
matplotlib实例一 分段式柱状图(堆叠式柱状图)
话不多说, 先看代码 labels = ['A', 'B', 'C', 'D', 'E'] blue = [10, 20, 30, 40, 50] yellow = [35, 15, 25, 20, 10] blue_err = [1, 1, 1, 1, 1] yellow_err = [1, 1, 1, 1, 1] width = 0.5 fig, ax = plt.subplots() ax.bar(labels, blue, width, yerr=blue_err, label='blue',原创 2020-08-17 00:12:22 · 3699 阅读 · 2 评论 -
matplotlib 学习二(读取图片)
import matplotlib.cbook as cbook import matplotlib.pyplot as plt with cbook.get_sample_data('1.png') as image_file: # 原生只支持png格式 image = plt.imread(image_file) fig, ax = plt.subplots() ax.imshow(image) ax.axis('off') # 不展示坐标系 ...原创 2020-06-08 20:52:23 · 422 阅读 · 0 评论 -
matplotlib 学习一
import matplotlib import matplotlib.pyplot as plt import numpy as np t = np.arange(0.0, 2.0, 0.01) s = 1 + np.sin(2 * np.pi * t) fig, ax = plt.subplots() # 创建一个figure 和 多个子图 ax.plot(t, s) ax.set(xlabel='time(s)', ylabel='voltage(mV)', title="this is tit.原创 2020-05-19 20:39:00 · 122 阅读 · 0 评论