小编OfO*_*Own的帖子

Matplotlib标题跨越两个(或任意数量)子图列

由于我正在绘制的内容的性质,我希望子图类似于嵌套表.我不确定如何清楚地问这个问题,所以我会添加一些图片,我希望能说明这个问题.

是)我有的:

Matplotlib图表标题和轴标题

我想要的是:

带有标题和轴标题的Matplotlib图和想要的子标题

当前(缩短的)代码看起来像这样:

fig, axes = plt.subplots(nrows=5, ncols=4) 
fig.suptitle(title, fontsize='x-large')
data0.plot(x=data0.x, y=data0.y, ax=axes[0,0],kind='scatter')
data1.plot(x=data1.x, y=data1.y, ax=axes[0,1],kind='scatter')
axes[0,0].set_title('title 0')
axes[0,1].set_title('title 1')
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚如何一起设置轴[0,0]和[0,1]的标题.我在文档中也找不到任何内容.我不喜欢用乳胶桌来解决这个问题.有什么指针吗?

抱歉,如果之前有人问过,我找不到任何东西,尤其是因为我不确定如何命名问题!

python matplotlib title subtitle

10
推荐指数
2
解决办法
2331
查看次数

Sort all columns of a dataframe

I have a dataframe of 2000 rows and 500 columns. I want to sort every column in ascending order. The columns don't have names they're just numbered 0-500.

Random data: df = pandas.DataFrame(np.random.randint(0,100,size=(2000, 500)), columns=range(500))

Using df.sort_values(by=0,axis=0) sorts the 0th column, as expected. But then using df.sort_values(by=1,axis=0) sorts the 1st column but shuffles the 0th column again. In other words, I want

index  0  1  2
1      5  5  5
2      6  7  5
3      7  9  8
Run Code Online (Sandbox Code Playgroud)

But I …

python sorting dataframe pandas

8
推荐指数
3
解决办法
6337
查看次数

标签 统计

python ×2

dataframe ×1

matplotlib ×1

pandas ×1

sorting ×1

subtitle ×1

title ×1