- 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 show different colors for points and line in a Seaborn regplot?
To show different colors for points and line in a Seaborn regplot, we can take the following steps −
Set the figure size and adjust the padding between and around the subplots.
Make a Pandas dataframe with key X-axis and Y-axis.
Plot numeric independent variables with regression model.
To display the figure, use show() method.
Example
import pandas import matplotlib.pylab as plt import seaborn as sns import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True df = pandas.DataFrame({"X-Axis": [np.random.randint(5) for i in range(10)], "Y-Axis": [np.random.randint(5) for i in range(10)]}) sns.regplot(x='X-Axis', y='Y-Axis', data=df, scatter_kws={"color": "red"}, line_kws={"color": "green"}) plt.show()
Output
- Related Articles
- How to show an image in Matplotlib in different colors with different channels?
- How to specify different colors for different bars in a Python matplotlib histogram?
- How to increase the line thickness of a Seaborn Line?
- Plot different colors for different categorical levels using matplotlib
- How to create density plot for categories filled with different colors in R?
- How to use different markers for different points in a Pylab scatter plot(Matplotlib)?
- How to make Violinpot with data points in Seaborn?
- How to create progress bar in different colors in Bootstrap
- How to display legend in base R with different colors?
- How to plot a dashed line on a Seaborn lineplot in Matplotlib?
- How to change the line color in a Seaborn linear regression jointplot?
- How to create a scatterplot with colors of the group of points in R?
- How to show the title for the diagram of Seaborn pairplot() or PridGrid()? (Matplotlib)
- Why Do Different Flowers Bear Different Colors?
- How to create horizontal lines with two different colors after a threshold in R?

Advertisements