- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to adjust transparency (alpha) in Seaborn pairplot using Matplotlib?
To adjust transparency, i.e., aplha in Seaborn pairplot, we can change the value of alpha.
Steps
Create a dataframe using Pandas with two keys, col1 and col2.
Initialize the variable, alpha, for transparency.
Use pairplot() method to plot pairwise relationships in a dataset. Use df (from step 1), kind="scatter", and set the plot size, edgecolor, facecolor, linewidth and alpha vaues in the arguments.
To display the figure, use show() method.
Example
import pandas as pd import seaborn as sns from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True df = pd.DataFrame({"col1": [1, 3, 5, 7, 1], "col2": [1, 5, 7, 9, 1]}) alpha = 0.75 sns.pairplot(df, kind="scatter", plot_kws=dict(s=100, edgecolor="red", fc='green', linewidth=2.5, alpha=alpha)) plt.show()
Output
- Related Articles
- Auto adjust font size in Seaborn heatmap using Matplotlib
- How to show the title for the diagram of Seaborn pairplot() or PridGrid()? (Matplotlib)
- How to adjust the space between Matplotlib/Seaborn subplots for multi-plot layouts?
- How to Adjust the Number of Ticks in Seaborn Plots?
- How to Adjust Marker Size in Matplotlib?
- How to change the figuresize using Seaborn factorplot in Matplotlib?
- How to plot multiple Seaborn Jointplot in Subplot using Matplotlib?
- How to make a heatmap square in Seaborn FacetGrid using Matplotlib?
- How to customize the axis label in a Seaborn jointplot using Matplotlib?
- How to add percentages on top of bars in Seaborn using Matplotlib?
- How to turn off error bars in Seaborn Bar Plot using Matplotlib?
- Add minor gridlines to Matplotlib plot using Seaborn
- Adjusting Text background transparency in Matplotlib
- Transparency for Poly3DCollection plot in Matplotlib
- Rotate xtick labels in Seaborn boxplot using Matplotlib

Advertisements