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

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 #00a9cf
6 AR6-SSP1-2.6 #003466
7 AR6-SSP2-4.5 #f69320
8 AR6-SSP3-7.0 #df0000
9 AR6-SSP3-LowNTCF #e61d25
10 AR6-SSP4-3.4 #2274ae
11 AR6-SSP4-6.0 #b0724e
12 AR6-SSP5-3.4-OS #92397a
13 AR6-SSP5-8.5 #980002
14 AR6-RCP-2.6 #003466
15 AR6-RCP-4.5 #709fcc
16 AR6-RCP-6.0 #c37900
17 AR6-RCP-8.5 #980002
18 AR5-RCP-2.6 #0000FF
19 AR5-RCP-4.5 #79BCFF
20 AR5-RCP-6.0 #FF822D
21 AR5-RCP-8.5 #FF0000
22 AR6-C1 #97CEE4
23 AR6-C2 #778663
24 AR6-C3 #6F7899
25 AR6-C4 #A7C682
26 AR6-C5 #8CA7D0
27 AR6-C6 #FAC182
28 AR6-C7 #F18872
29 AR6-C8 #BD7161
31 AR6-IMP-Ren #EED2AE
32 AR6-IMP-SP #F7E7D7
33 AR6-IMP-Neg #B8BDAA
35 AR6-IP-ModAct #DDB6AB
36 AR6-IP-CurPol #F9C8B7

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 - INFO: Running in a notebook, setting up a basic logging at level INFO
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'>