Additional keyword arguments in seaborn jointplot

I am trying to figure out how the matplotlib and seaborn plotting functions are related. In particular, I would like to know which pyplot arguments can be passed to the dicts marginal_kws and annot_kws in the seaborn.jointplot() function.

Suppose we have a DataFrame data with columns c0 and c1 . I assumed that joint_kws accepts arguments from pyplot.hexbin() , so when I tried to customize the look 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 the log scale on the axis of the histogram with the 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}) 

The result is

 TypeError: distplot() got an unexpected keyword argument 'log' 

How to do it right?

PS This question is not connected with setting logarithmic scales in the seabed (with JointGrid , I know), but rather with passing matplotlib arguments to sea functions in general.

+6
source share
1 answer

The keyword argument dictionary is passed to distplot , which accepts the dictionary for hist_kws . So you need to do something like marginal_kws={'hist_kws': {'log': True}} . With that said, common log axes remain a steady headache with jointplot , and I couldn’t get something that looked good out of the box when adapting your code. However, some settings may make it work.

It may also be useful to try JointGrid to avoid such complexity.

+6
source

Source: https://habr.com/ru/post/976709/


All Articles