close

How to adjust transparency (alpha) in seaborn pairplot?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to adjust transparency (alpha) in seaborn pairplot in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to adjust transparency (alpha) in seaborn pairplot?

  1. How to adjust transparency (alpha) in seaborn pairplot?

    Alpha can be set as a keyword argument as so:
    g = sns.pairplot(df, kind='scatter', alpha=0.1})

  2. adjust transparency (alpha) in seaborn pairplot

    Alpha can be set as a keyword argument as so:
    g = sns.pairplot(df, kind='scatter', alpha=0.1})

Method 1

Ok I was very close to the solution. Seaborn pairplots have plot_kws that takes as arguments a dictionary of the kind of modifications you would do in a regplot. The following line is exactly what I needed:

g = sns.pairplot(df, kind='reg', plot_kws={'line_kws':{'color':'red'}, 'scatter_kws': {'alpha': 0.1}})

And this is the outcome:

enter image description here

If you don’t do the regression but just the scatter plot (kind=’scatter’), within plot keywords you don’t have to do the division between line and scatter keywords:

g = sns.pairplot(df, kind='scatter', plot_kws={'alpha':0.1})

Method 2

Alpha can be set as a keyword argument as so:

g = sns.pairplot(df, kind='scatter', alpha=0.1})

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read