Search code examples
pythonseabornhistogramjointplot

Bin size seaborn jointplot


I have an array of 90 000 pairs I want to plot with seaborn jointplot. Is there a way to adjust side histograms bin size? Should I try to plot it with an other package?enter image description here


Solution

  • You should be able to use marginal_kws to adjust the bins. Lifting the example from the seaborn documentation here

    Tested in python 3.10, matplotlib 3.5.1, seaborn 0.11.2

    import seaborn as sns
    
    # load sample data
    iris = sns.load_dataset('iris')
    
    g = sns.jointplot(x="petal_length", y="sepal_length", data=iris,
                       marginal_kws=dict(bins=30), s=40)
    

    enter image description here

    • without using marginal_kws
    g = sns.jointplot(x="petal_length", y="sepal_length", data=iris, s=40)
    

    enter image description here