![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
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 · 118 阅读 · 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 · 212 阅读 · 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.5fig, ax = plt.subplots()ax.bar(labels, blue, width, yerr=blue_err, label='blue',原创 2020-08-17 00:12:22 · 3674 阅读 · 2 评论 -
matplotlib 学习二(读取图片)
import matplotlib.cbook as cbookimport matplotlib.pyplot as pltwith 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 · 419 阅读 · 0 评论 -
matplotlib 学习一
import matplotlibimport matplotlib.pyplot as pltimport numpy as npt = 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 · 121 阅读 · 0 评论