Search code examples
pythonplotseaborndata-analysis

Change plot color seaborn package


I would like to change colors in this plot, it visualizes data properly but as you can see it isn't easy to read because all this colors are very similar (7 classes). Is there simple way to do it? Code for generating plot:

sns.pairplot(data, kind="scatter", hue = "Class")

Piece of plot


Solution

  • You can use the optional argument palette, such as in (see here):

    sns.pairplot(data, kind="scatter", hue = "Class", palette = "Paired")
    

    In this case, I chose the color palette "Paired", but there are many others. You could also use:

    sb.set_palette("dark")
    sns.pairplot(data, kind="scatter", hue = "Class")
    

    You can learn more about the available color palettes in the Seaborn site, https://seaborn.pydata.org/tutorial/color_palettes.html.