how to change colour priority in seaborn while creating scatter plot matrix

Viewed 1111

I am creating a scatter plot using following code:

import seaborn as sns
sns.set(style="ticks")
sns.pairplot(visualdf, hue="Target")

I have the output category in target, so I am getting 3 colours, red, blue and green. As red is 95 percent of total points, blue 4 percent and green 1 percent.

The data points are overlapping because of this.

I want to set the priority on colours that green will be on top priority followed by blue and red. So if it's overlap, it will display the top priority column.

How to do this in efficient way.

1 Answers

You can do something like this:

import seaborn as sns
sns.set(style="ticks")
visuald_otherOrder = visuald.sort_values(by=['Target'], ascending=False)
sns.pairplot(visualdf_otherOrder, hue="Target")
Related