小编Fen*_*rir的帖子

将带有子图的熊猫图保存到一个文件

我正在从以下数据框在pandas / jupyter笔记本中创建子图

METHOD1       A           B             C              D             E
METHOD2                                                                
high       1410          14           426          13781             1
low       74142         303        757024          95105            37
medium    99174         670        277013         640000           127
mono      46599         207        405108          16793           160

axs = ct.plot(kind='barh', subplots=True, legend=False, figsize=(24,16))
for ax in axs:
    ax.set_xscale('log')
Run Code Online (Sandbox Code Playgroud)

在Jupyter中,我得到一张包含4个子图的图像。我想将该图保存为一个png,但是

fig=axs.get_figure()
fig.savefig('plot.png')
Run Code Online (Sandbox Code Playgroud)

给出错误信息

AttributeError:“ numpy.ndarray”对象没有属性“ get_figure”

因为axs是子图的数组,所以我可以保存单个子图。

如何将所有子图保存到一张图像?

python plot matplotlib pandas

4
推荐指数
1
解决办法
1249
查看次数

如何在R中找到向量中连续数字的范围

我在 R 中有一个向量:

data <- c(1,4,6,7,8,9,20,30,31,32,33,34,35,60)
Run Code Online (Sandbox Code Playgroud)

我想要的是找到超过 3 个连续值的连续拉伸的开始和结束。IE:

start end
3  6  (stretch 6-9)
8 13 (stretch 30-35
Run Code Online (Sandbox Code Playgroud)

我不知道如何到达那里。

r

2
推荐指数
1
解决办法
659
查看次数

标签 统计

matplotlib ×1

pandas ×1

plot ×1

python ×1

r ×1