
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 a jointplot with 'hue' parameter in Seaborn? (Matplotlib)
To plot a jointplot with hue parameter in Seaborn, we can take the following steps −
Steps
- Set the figure size and adjust the padding between and around the subplots.
- Create x data points using numpy.
- Make a dictionary with some curve data.
- Make a dataframe for tabular data.
- Make a jointplot using jointplot() method.
- To display the figure, use show() method.
Example
from matplotlib import pyplot as plt import pandas as pd import seaborn as sns import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(0, 1, 5) d = { 'y=sin(x)': np.sin(x), 'y=cos(x)': np.cos(x), 'y=x': x, } df = pd.DataFrame(d) jg = sns.jointplot(data=df, x="y=sin(x)", y="y=cos(x)", height=3.5, hue="y=x") plt.show()
Output
- Related Questions & Answers
- How to plot multiple Seaborn Jointplot in Subplot using Matplotlib?
- How to plot a non-square Seaborn jointplot or JointGrid? (Matplotlib)
- How does parameters 'c' and 'cmap' behave in a Matplotlib scatter plot?
- How to customize the axis label in a Seaborn jointplot using Matplotlib?
- How to save a plot in Seaborn with Python (Matplotlib)?
- Update 'a' record with 'b' and 'b' with 'a' in a MySQL column (swap) with only 'a' and 'b' values?
- Customizing annotation with Seaborn's FacetGrid
- How to unset 'sharex' or 'sharey' from two axes in Matplotlib?
- How to plot multiple histograms on same plot with Seaborn using Matplotlib?
- How to add a shared x-label and y-label to a plot created with Pandas' plot? (Matplotlib)
- Adding a line to a scatter plot using Python's Matplotlib
- How to turn off transparency in Matplotlib's 3D Scatter plot?
- How to label and change the scale of a Seaborn kdeplot's axes? (Matplotlib)
- Replace '*' with '^' with Java Regular Expressions
- What is the difference between 'log' and 'symlog' in matplotlib?
Advertisements