pandas scatter_matrix函数中'ax'关键字的用途 [英] Purpose of 'ax' keyword in pandas scatter_matrix function

查看:173
本文介绍了 pandas scatter_matrix函数中'ax'关键字的用途的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对熊猫 scatter_matrix 函数中' ax '关键字的含义感到困惑:

I'm puzzled by the meaning of the 'ax' keyword in the pandas scatter_matrix function:

pd.scatter_matrix(frame,alpha = 0.5,figsize = None, ax = None ,grid = False,对角线='hist',marker ='.',density_kwds = {},hist_kwds = {},** kwds)

pd.scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False, diagonal='hist', marker='.', density_kwds={}, hist_kwds={}, **kwds)

文档字符串中有关ax关键字的唯一线索对我来说太神秘了:

The only clue given in the docstring for the ax keyword is too cryptic for me:

ax : Matplotlib axis object

我查看了scatter_matrix函数的熊猫代码,并将ax变量并入以下matplotlib子图调用中:

I had a look in the pandas code for the scatter_matrix function, and the ax variable is incorporated in the following matplotlib subplots call:

fig, axes = plt.subplots(nrows=n, ncols=n, figsize=figsize, ax=ax,
                         squeeze=False)

但是,对我而言,我在matplotlib子图中找不到对'ax'关键字的任何引用!

But, for the life of me, I can't find any reference to an 'ax' keyword in matplotlib subplots!

谁能告诉我这个ax关键字是干什么的??

Can anyone tell me what this ax keyword is for???

推荐答案

简而言之,它以网格内的子图为目标.

In short, it targets a subplot within a grid.

例如,如果具有nrows=2ncols=2,则ax允许您通过ax=axes[0,0](左上)或ax=axes[1,1](右下)等在特定轴上进行绘制.

If you have nrows=2 and ncols=2, for example, then ax allows you to plot on a specific axis by passing ax=axes[0,0] (top left) or ax=axes[1,1] (bottom right), etc.

创建子图时,您会收到一个axes变量.您可以稍后使用该axes变量的元素来绘制(或子绘制).

When you create the subplots, you receive an axes variable. You can later plot (or subplot) with an element of that axes variable as above.

查看此页面的定位不同的子图" 部分:我希望这会有所帮助.

这篇关于 pandas scatter_matrix函数中'ax'关键字的用途的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆