- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 plot two Seaborn lmplots side-by-side (Matplotlib)?
63 Lectures 6 hours
To plot two graphs side-by-side in Seaborn, we can take the following steps −
To create two graphs, we can use nrows=1, ncols=2 with figure size (7, 7).
Create a data frame with keys, col1 and col2, using Pandas.
Use countplot() to show the counts of observations in each categorical bin using bars.
Adjust the padding between and around the subplots.
To display the figure, use show() method.
import pandas as pd import numpy as np import seaborn as sns from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True f, axes = plt.subplots(1, 2) df = pd.DataFrame(dict(col1=np.linspace(1, 10, 5), col2=np.linspace(1, 10, 5))) sns.countplot(df.col1, x='col1', color="red", ax=axes) sns.countplot(df.col2, x="col2", color="green", ax=axes) plt.show()
- How to plot two histograms side by side using Matplotlib?
- How do I plot two countplot graphs side by side in Seaborn using Matplotlib?
- How to plot bar graphs with same X coordinates side by side in Matplotlib?
- How to make two plots side-by-side using Python?
- How to align images side by side with CSS?
- How to create side-by-side boxplot in base R?
- How to create side by side histograms in base R?
- How to create side by side barplot in base R?
- How we can put two divisions <div> side by side in HTML?
- How to move the Y-axis ticks from the left side of the plot to the right side in matplotlib?
- How we can put three divisions <div> side by side in HTML?
- How to plot the X-axis labels on the upper-side of the plot in R?
- How to plot multiple histograms on same plot with Seaborn using Matplotlib?
- Add minor gridlines to Matplotlib plot using Seaborn
- How to plot multiple Seaborn Jointplot in Subplot using Matplotlib?