简体   繁体   中英

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

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.

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")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM