seaborn jointplot中的其他关键字参数

kur*_*sis 6 python matplotlib seaborn

我试图找出matplotlib和seaborn绘图函数是如何关联的.特别是,我想知道什么样的pyplot参数可以传递给关键字dicts marginal_kwsannot_kws函数seaborn.jointplot().

假设我们有data包含列c0和的DataFrame c1.我猜测joint_kws接受来自的参数pyplot.hexbin(),所以当我试图用那里的参数调整外观时,它工作得很好:

import seaborn as sns   
sns.jointplot('c0', 'c1', data=data,  kind='hex',
               joint_kws={'gridsize':100, 'bins':'log', 'xscale':'log', 'yscale':'log'})
Run Code Online (Sandbox Code Playgroud)

然后我试图在直方图轴与参数设置日志规模log=Truepyplot.hist():

    sns.jointplot('c0', 'c1', data=data,  kind='hex',
                   joint_kws={'gridsize':100, 'bins':'log', 'xscale':'log', 'yscale':'log'}, 
                   marginal_kws={'log':True})
Run Code Online (Sandbox Code Playgroud)

这导致了

TypeError: distplot() got an unexpected keyword argument 'log'
Run Code Online (Sandbox Code Playgroud)

怎么说得对?

PS这个问题不是关于在seaborn中设置日志比例(JointGrid我知道),而是将matplotlib参数作为一个整体传递给seaborn函数.

mwa*_*kom 6

关键字参数的字典被传递给distplot,它需要一个字典hist_kws.所以你必须做类似的事情marginal_kws={'hist_kws': {'log': True}}.话虽如此,共享日志轴仍然是一个持久的头痛jointplot,在调整代码时我无法获得看起来很好的东西.但是,一些调整可能会让它发挥作用.

尝试JointGrid 直接使用以避免这种复杂性也可能是有用的.