By default seaborn uses the matplotlib default colors. If you have not changed the default matplotlib parameters, this would be the colors from the "tab10" colormap.

sns.set_palette("tab10")

If however you have set some style beforehands, e.g. using sns.set(), this would set the palette to "deep". Hence you would get this back using

sns.set_palette("deep")
Answer from ImportanceOfBeingErnest on Stack Overflow
🌐
Seaborn
seaborn.pydata.org › tutorial › color_palettes.html
Choosing color palettes — seaborn 0.13.2 documentation
Qualitative palettes are well-suited to representing categorical data because most of their variation is in the hue component. The default color palette in seaborn is a qualitative palette with ten distinct hues:
🌐
Noga H. Rotman
r02b.github.io › seaborn_palettes
Seaborn Color Palettes and How to Use Them | Noga H. Rotman
November 8, 2022 - This pattern of variations creates different colors with very similar luminosity and saturation, so the palette looks cohesive, and there is no “special” color that stands out compared to the others. The matlab default palette we all know and love is called tab10, and is also the default palette for most seaborn functions.
🌐
Codecademy
codecademy.com › article › seaborn-color-palettes-complete-guide-to-data-visualization-colors
Seaborn Color Palettes: Complete Guide to Data Visualization Colors | Codecademy
As you can see, Matplotlib’s default color palette uses basic, less coordinated colors on a white background. However, Seaborn’s default styling features softer, more visually appealing colors along with a gray grid background that improves readability and contrast.
🌐
YouTube
youtube.com › watch
Seaborn Color Palette Basics | Using named and custom color palettes in Python seaborn - YouTube
Explore seaborn color palettes with this video tutorial on seaborn palette options. We start with the basics of seaborn's default color palette through the ...
Published: August 23, 2021
🌐
Lobster Land
lobsterland.net › 2-13-palettes-in-seaborn
2.13 Palettes in Seaborn - Lobster Land
September 25, 2022 - Any of these palettes can be viewed by inserting the palette’s name, inside quotation marks, to seaborn’s color_palette() function. Let’s take a look at ‘icefire’: By default, icefire only shows us six colors; however, we can modify that with one parameter adjustment in the color_palette() function:
🌐
Datavizpyr
datavizpyr.com › home › how to change colors in seaborn (custom palettes and manual colors)
How to Change Colors in Seaborn (Custom Palettes and Manual Colors) - Data Viz with Python and R
August 25, 2025 - Seaborn automatically selects a palette when you map a variable to hue. This default is great for quick exploration and ensures high baseline readability. In this section, you’ll see how Seaborn colors categories without any extra configuration.
Find elsewhere
🌐
Kaggle
kaggle.com › code › analystoleksandra › colour-palettes-of-seaborn
Colour palettes of seaborn
October 22, 2023 - Explore and run AI code with Kaggle Notebooks | Using data from House Prices - Advanced Regression Techniques
🌐
Seaborn
seaborn.pydata.org › generated › seaborn.set_palette.html
seaborn.set_palette — seaborn 0.13.2 documentation - PyData |
Set the matplotlib color cycle using a seaborn palette. ... Palette definition. Should be something color_palette() can process. ... Number of colors in the cycle. The default number of colors will depend on the format of palette, see the color_palette() documentation for more information.
🌐
Medium
medium.com › learning-data › an-analysts-guide-to-choosing-the-perfect-colors-in-seaborn-15ef8642f84a
An Analyst’s Guide to Choosing the Perfect Colors in Seaborn | by Annette Dolph | Learning Data | Medium
November 7, 2023 - In this article, we’ll explore the color choices available in Seaborn, ranging from simple color selection to more complex color palettes.
🌐
DataCamp
datacamp.com › tutorial › seaborn-palettes
Seaborn Color Palette: Quick Guide to Picking Colors | DataCamp
September 30, 2024 - The color_palette() function is Seaborn’s way of creating custom color palettes. It allows you to switch between these different types of palettes by changing the palette name and the number of colors. When using named palettes (like "pastel" or "Blues"), the number parameter determines how many colors you see.
🌐
Medium
medium.com › analytics-vidhya › deep-dive-into-seaborn-palettes-7b5fae5a258e
Deep Dive into Seaborn: Color Palettes | by Yoann Mocquin | Analytics Vidhya | Medium
November 24, 2022 - the hex space : a color is defined by 6 hex-characters #RRGGBB where RR (red), GG (green) and BB (blue) are hexadecimal integers between 00 and FF specifying the intensity of the color.
🌐
GitHub
github.com › mwaskom › seaborn › blob › master › seaborn › palettes.py
seaborn/seaborn/palettes.py at master · mwaskom/seaborn
set_palette : Set the default color cycle for all plots. set_color_codes : Reassign color codes like ``"b"``, ``"g"``, etc. to · colors from one of the seaborn palettes. · Examples · -------- · .. include:: ../docstrings/color_palette.rst ·
🌐
Practicalpythonfordatascience
practicalpythonfordatascience.com › ap_seaborn_palette
Seaborn Color Palettes — Practical Python for Data Science
Here are some options for Seaborn palette: Below is a complete list of all palette options. Most palettes can have the suffix "_r" to indicate the same palette but reversed order. A few palettes can have "_d" appended at the end which indicates a darker version of the original palette. sns.color_palette(palette='Accent') sns.color_palette(palette='Blues') sns.color_palette(palette='Blues_d') sns.color_palette(palette='BrBG') sns.color_palette(palette='BuGn') sns.color_palette(palette='BuPu') sns.color_palette(palette='CMRmap') sns.color_palette(palette='Dark2') sns.color_palette(palette='GnBu'
🌐
GeeksforGeeks
geeksforgeeks.org › data science › seaborn-color-palette
Seaborn - Color Palette - GeeksforGeeks
sns.set_palette("Set2"): This sets the color palette to "Set2", one of Seaborn's predefined color palettes.
Published: April 8, 2025
🌐
EDUCBA
educba.com › home › data science › data science tutorials › seaborn tutorial › seaborn color palette
Seaborn Color Palette | Complete Guide on Seaborn Color Palette
May 14, 2024 - This default color depends on the library of matplotlib. ... Seaborn is using the color brewer palette. The color brewer is setting the color palette.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
APXML
apxml.com › courses › data-visualization-matplotlib-seaborn › chapter-4-seaborn-enhanced-visuals-intro › seaborn-color-palettes
Using Seaborn Color Palettes
It helps distinguish between different groups of data, represent data values, and simply make plots more visually appealing and easier to interpret. While Matplotlib provides basic color options, Seaborn offers a more refined and flexible system for working with colors through its color palettes.
Top answer
1 of 3
1

The specific palette you have mentioned is the cubehelix and you can get it using:

sns.cubehelix_palette()

You can get the colours using indexing:

sns.cubehelix_palette()[:]

# [[0.9312692223325372, 0.8201921796082118, 0.7971480974663592],
#  [0.8559578605899612, 0.6418993116910497, 0.6754191211563135],
#  [0.739734329496642, 0.4765280683170713, 0.5959617419736206],
#  [0.57916573903086, 0.33934576125314425, 0.5219003947563425],
#  [0.37894937987025, 0.2224702044652721, 0.41140014301575434],
#  [0.1750865648952205, 0.11840023306916837, 0.24215989137836502]]

In general, checking the official docs or in the case when you need to check some defaults of seaborn (which is the only case when you don't know what the palette is, otherwise you know because you're the one defining it), you can always check the github code (eg. here or here).

2 of 3
1

In your first graph the cylinders is a continuous variable of type int64 and seaborn is using a single color, in this case purple, and shading it to indicate the scale of the value, so that 8 cylinders would be darker than 4. This is done on purpose so you can easily tell what is what by the shade of the color.

Once you convert to categorical halfway through there is no longer such a relationship between the cylinder values, i.e. 8 cylinders is not twice as much a 4 cylinders anymore, they are essentially two totally different categories. To avoid associating the shade of color with the scale of the variable (since the values are no longer continuous and the relationship doesn't exist) a categorical color palette will be used by default, such that every color is distinct from the other.

In order to solve your problem, you will need to cast cylinders back to int64 prior to running your final chart with

df.cylinders = df.cylinders.astype('int64')

This will restore the variable to a continuous one and will allow seaborn to use gradients of the same color to represent the size of the values and your final plot will look just like the first one.

import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import plotly.express as px
import warnings
warnings.filterwarnings("ignore")

# download data
df = pd.read_csv("https://www.statlearning.com/s/Auto.csv")
df.head()

# remove rows with "?"
df.drop(df.index[~df.horsepower.str.isnumeric()], axis=0, inplace=True)
df['horsepower'] = pd.to_numeric(df.horsepower, errors='coerce')

# plot 1 (gives the desired color-palette)
fig = sns.PairGrid(df, vars=df.columns[~df.columns.isin(['cylinders','origin','name'])].tolist(), hue='cylinders')
plt.gcf().set_size_inches(17,15)
fig.map_diag(sns.histplot)
fig.map_upper(sns.scatterplot)
fig.map_lower(sns.kdeplot)
fig.add_legend(ncol=5, loc=1, bbox_to_anchor=(0.5, 1.05), borderaxespad=0, frameon=False);

# plot 2
# Converting column cylinder to factor before using for 'color'
df.cylinders = df.cylinders.astype('category')

# Scatter plot - Cylinders as hue
pal = ['#fdc086','#386cb0','#beaed4','#33a02c','#f0027f']
col_map = dict(zip(sorted(df.cylinders.unique()), pal))
fig = px.scatter(df, y='mpg', x='year', color='cylinders', 
                 color_discrete_map=col_map, 
                 hover_data=['name','origin'])
fig.update_layout(width=800, height=400, plot_bgcolor='#fff')
fig.update_traces(marker=dict(size=8, line=dict(width=0.2,color='DarkSlateGrey')),
                  selector=dict(mode='markers'))
fig.show()

# plot 1 run again
df.cylinders = df.cylinders.astype('int64')
fig = sns.PairGrid(df, vars=df.columns[~df.columns.isin(['cylinders','origin','name'])].tolist(), hue='cylinders')
plt.gcf().set_size_inches(17,15)
fig.map_diag(sns.histplot)
fig.map_upper(sns.scatterplot)
fig.map_lower(sns.kdeplot)
fig.add_legend(ncol=5, loc=1, bbox_to_anchor=(0.5, 1.05), borderaxespad=0, frameon=False);

Output