Using IPCC Color Palettes

pyam supports the use of explicit IPCC AR5 and AR6 color palettes by providing the RCP and/or SSP of interest via the pyam.run_control() feature.

import pandas as pd
import pyam
pyam - INFO: Running in a notebook, setting `pyam` logging level to `logging.INFO` and adding stderr handler

The full list of the IPCC color palette colors avaialable in pyam can be retrieved by the following code.

colors = pyam.plotting.PYAM_COLORS
pd.DataFrame({'name': list(colors.keys()), 'color': list(colors.values())})
name color
0 AR6-SSP1 #1e9583
1 AR6-SSP2 #4576be
2 AR6-SSP3 #f11111
3 AR6-SSP4 #e78731
4 AR6-SSP5 #8036a7
5 AR6-SSP1-1.9 #1e9583
6 AR6-SSP1-2.6 #1d3354
7 AR6-SSP2-4.5 #e9dc3d
8 AR6-SSP3-7.0 #f11111
9 AR6-SSP3-LowNTCF #f11111
10 AR6-SSP4-3.4 #63bce4
11 AR6-SSP4-6.0 #e78731
12 AR6-SSP5-3.4-OS #996dc8
13 AR6-SSP5-8.5 #830b22
14 AR6-RCP-2.6 #980002
15 AR6-RCP-4.5 #c37900
16 AR6-RCP-6.0 #709fcc
17 AR6-RCP-8.5 #003466
18 AR5-RCP-2.6 #0000FF
19 AR5-RCP-4.5 #79BCFF
20 AR5-RCP-6.0 #FF822D
21 AR5-RCP-8.5 #FF0000

Display scenario data with default colours

We use the scenario ensemble from the first-steps tutorial (here on GitHub and on read the docs). Let’s pull out two example scenarios (implemented by multiple modelling frameworks each) and plot them with the default color scheme.

scenarios = ['CD-LINKS_NoPolicy', 'CD-LINKS_NPi2020_400']

df = (
    .filter(variable='Emissions|CO2', region='World', scenario=scenarios)

pyam.core - INFO: Reading file `tutorial_data.csv`
<AxesSubplot:title={'center':'region: World variable: Emissions|CO2'}, xlabel='Year', ylabel='Mt CO2/yr'>

As an example, we assume that each of these two sets of scenarios correspond to categorizations in the AR6 context. We can utilize the specific colors by following two steps:

  1. Update pyam.run_control() telling it which scenario name maps to which AR6 color

  2. Call line_plot using that color mapping

Updating the run control

We need to tell pyam that whenever it sees a certain scenario name, it should use a specific color from the IPCC palette.

color_map = {
    'CD-LINKS_NPi2020_400': 'AR6-SSP2-4.5',
    'CD-LINKS_NoPolicy': 'AR6-SSP5-8.5',

pyam.run_control().update({'color': {'scenario': color_map}})

The illustration above is implemented directly in Python code, but it also works by specifying the desired mapping in a yaml configuration file and loading that file into run_control().

Use the new colors

Now, it’s as simple as calling the plot function again!

<AxesSubplot:title={'center':'region: World variable: Emissions|CO2'}, xlabel='Year', ylabel='Mt CO2/yr'>