I'm trying to find out how matplotlib and seaborn plotting functions are associated. Particularly, I'd like to know what pyplot arguments can be passed into keyword dicts marginal_kws
and annot_kws
in function seaborn.jointplot()
.
Suppose we have DataFrame data
with columns c0
and c1
. I guessed that joint_kws
accepts arguments from pyplot.hexbin()
, so when I tried to tune the appearance with arguments from there, it worked fine:
import seaborn as sns
sns.jointplot('c0', 'c1', data=data, kind='hex',
joint_kws={'gridsize':100, 'bins':'log', 'xscale':'log', 'yscale':'log'})
Then I tried to set log scale at histogram axes with an argument log=True
from pyplot.hist()
:
sns.jointplot('c0', 'c1', data=data, kind='hex',
joint_kws={'gridsize':100, 'bins':'log', 'xscale':'log', 'yscale':'log'},
marginal_kws={'log':True})
This results in
TypeError: distplot() got an unexpected keyword argument 'log'
How to put it right?
P.S. This question is not about setting log scales in seaborn (with JointGrid
, i know), but rather about passing matplotlib arguments into seaborn functions as a whole.
The dictionary of keyword arguments gets passed to distplot
, which takes a dictionary for hist_kws
. So you'll have to do something like marginal_kws={'hist_kws': {'log': True}}
. With that said, shared log axes remain an enduring headache with jointplot
, and I couldn't get something that looked good out of the box when adapting your code. Some tweaking might get it working, though.
It may also be useful to try and use JointGrid
directly to avoid this kind of complexity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With