Answers for "seaborn scatterplot parameters"

5

seaborn scatter plot

import seaborn as sns

sns.scatterplot(data=df, x="x_var", y="y_var")
Posted by: Guest on May-09-2021
0

sns color specific points

import pandas as pd
import numpy as np
import matplotlib.pylab as plt
import seaborn as sns
 
# Create data frame. The last column is the needed color
df = pd.DataFrame(np.random.random((100,2)), columns=["x","y"])
 
# Add a column: the color depends of x and y values, but you can use whatever function.
value=(df['x']>0.2) & (df['y']>0.4)
df['color']= np.where( value==True , "#9b59b6", "#3498db")
 
# plot
sns.regplot(data=df, x="x", y="y", fit_reg=False, scatter_kws={'facecolors':df['color']})
#sns.plt.show()
Posted by: Guest on October-19-2020

Code answers related to "seaborn scatterplot parameters"

Python Answers by Framework

Browse Popular Code Answers by Language