seaborn scatter plot
import seaborn as sns
sns.scatterplot(data=df, x="x_var", y="y_var")
seaborn scatter plot
import seaborn as sns
sns.scatterplot(data=df, x="x_var", y="y_var")
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()
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us