The following code produces a seaborn pairplot.
How can I achieve that the red point (with b = 10.
) is visible in the subplot c/a (left bottom)?
Presently it is almost invisible as the points with b = 4
and b = 5
seem to be plotted afterwards and hide it.
Sorting the DataFrame unfortunately does not help.
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
def supplyHueByB(x, bMax):
amountOfSegments = 8
myReturn = int(x * amountOfSegments / bMax)
return myReturn
myList = [
[0.854297, 1.973376, 0.187038],
[0.854297, 2.204028, 0.012476],
[0.854297, 10.0, 0.056573],
[0.854297, 5.0, 0.050635],
[0.854297, 4.0, 0.058926]
]
df = pd.DataFrame(myList)
df.columns=['a', 'b', 'c']
bMax = df.b.max()
hue = df.b.apply(lambda x: supplyHueByB(x, bMax))
g = sns.pairplot(
df,
corner=True,
diag_kws=dict(color=".6"),
vars=['a', 'b', 'c'],
plot_kws=dict(
hue=hue,
palette="coolwarm",
edgecolor='None',
s=80 # size
),
)
plt.subplots_adjust(bottom=0.1)
g.add_legend()
plt.show()