I'm not sure if it's just the theme and darktheme that I'm using but I can't seem to change the colours of the histogram on my pairplot.
Is there a way to change them as they are very dark looking or is this just because of the theme?
g = sns.pairplot(df)
g.map_upper(sns.scatterplot,color='red')
g.map_lower(sns.scatterplot, color='green')
g.map_diag(plt.hist, color='blue')
Note that sns.pairplot
creates a PairGrid
and already draws the scatter dots and histogram. If you then draw your own histogram over it, thes probably don't coincide. Therefore, it can help to replace sns.pairplot
with sns.PairGrid
giving empty subplots.
The following code has been tested with Seaborn 0.11.1 and matplotlib 3.4.1.
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme('notebook', style='dark')
plt.style.use("dark_background")
df = sns.load_dataset('iris')
g = sns.PairGrid(df)
g.map_upper(sns.scatterplot, color='crimson')
g.map_lower(sns.scatterplot, color='limegreen')
g.map_diag(plt.hist, color='skyblue')
plt.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With