Using our colour palettes in Microsoft, R and Python

Policy details

Metadata item Details
Publication date:10 May 2023
Owner:Analysis Function Central Team
Who this is for:Anyone creating data visualisations
Type:Guidance
Contact:Analysis.Function@ons.gov.uk

Introduction

On this page you will find the hex codes for our recommended colour palettes for charts.

These are accompanied by examples of how to use these hex codes in R, Python and as a Microsoft (MS) theme download. There is also information on the packages created in Python and R by the Analysis Standards and Pipelines (ASAP) for the colour palettes.

If you are using a different program and need support using these hex codes, please email – Analysis.Function@ons.gov.uk.

If you use our codes or develop them further please let us know. We love to see our guidance in action.

Note: using these colour palettes will not automatically mean your charts are accessible. They should be used in line with our charts guidance.

This guidance was intended to show how to use our recommended colour palettes. If you find different or more effective ways to create these charts yourself, we would really like to hear from you. Email: Analysis.Function@ons.gov.uk.

Back to top of page

Categorical data colour palette

When to use the categorical data colour palette

Use this palette for categorical data. This is data which can be divided into groups or categories by using names or labels. For example, religion.

Palette table

Note: the cells in the “Example of colour” column may appear blank to screen reader software. They contain a colour fill, but no data.

ColourHex codeRGB code CYMK codeExample of colour
Dark blue#12436D(18, 67, 109)(83, 39, 0, 57)
Turquoise#28A197(40, 161, 151)(75, 0, 6, 37)
Dark pink #801650(128, 22, 80)(0, 83, 38, 50)
Orange#F46A25
(244, 106, 37)(0, 57, 85, 4)
Dark grey #3D3D3D(61, 61, 61)(0, 0, 0, 76)
Light purple#A285D1(162, 133, 209)(22, 36, 0, 18)

Figure 1: Clustered bar chart using the categorical data colour palette

The legend is presented in the same order as the bars in the clusters.

Large version of figure 1.

This example is made in Microsoft Excel. It uses fictional data about fruit stocks.

Figure 2: Pie chart using the categorical data colour palette

Larger version of figure 2.

This example is made in Microsoft Excel. It uses data from responses to the “What is your religion?” question on the 2011 Census of England and Wales.

Source: Religion in England and Wales 2011.

R Code

af_categorical_colours <- c(
"#12436D", # Dark blue
"#28A197", # Turquoise
"#801650", # Dark pink
"#F46A25", # Orange
"#3D3D3D", # Dark grey
"#A285D1" # Light purple
)

R code for using the colour palette in a clustered bar chart

#Load your packages
library(tidyverse)
library(ggplot2)

#Load in your colours
af_categorical_colours <- c("#12436D", "#28A197", "#801650", "#F46A25", "#3D3D3D", "#A285D1")

#Load in your data
clustered <- read_csv("/clustered.csv")

#Create your chart
ggplot(clustered, aes(fill = Fruit, y = Value, x = Shop)) +
geom_col(width = 0.6, position = position_dodge(0.7)) +
labs(x = "", y = "") +
ylim(0, 50) +
theme_classic(base_size = 18) +
theme(panel.grid.major.y = element_line("light grey"), legend.position="top", axis.line = element_line(FALSE), axis.ticks = element_line(FALSE)) +
scale_fill_manual(values = c(af_categorical_colours), name = "")

Figure 3: Clustered bar chart using categorical data colour palette – R output

The legend is presented in the same order as the bars in the clusters.

Larger version of figure 3.

R code for using the colour palette in a pie chart

#Load your packages
library(ggplot2)

#Load in your colours
af_categorical_colours <- c("#12436D", "#28A197", "#801650", "#F46A25", "#3D3D3D", "#A285D1")

#Load in your data
pie_data <- read_csv("/pie_data.csv")

pie_data$Religion <- factor(pie_data$Religion, levels = c("Christian", "No religion", "Other", "Not stated"))

#Create your chart
ggplot(pie_data, aes(x = "", y = -Percentage, fill = Religion)) +
geom_bar(stat = "identity", width = 2, color = "white") +
coord_polar(theta = "y", start = 0, direction = 1) +
theme_void() + # remove background, grid, numeric labels
theme(legend.position = "none") +
scale_fill_manual(values = c(af_categorical_colours), name = "") +
annotate("text", label = paste(pie_data$Religion[1], sep = "","(", pie_data$Percentage[1], "%)"), x = 2.70, y = -70) +
annotate("text", label = paste(pie_data$Religion[2], sep = "","(", pie_data$Percentage[2], "%)"), x = 2.75, y = -29) +
annotate("text", label = paste(pie_data$Religion[3], sep = "","(", pie_data$Percentage[3], "%)"), x = 2.45, y = -14) +
annotate("text", label = paste(pie_data$Religion[4], sep = "","(", pie_data$Percentage[4], "%)"), x = 2.35, y = -7)

Figure 4: Pie chart using categorical data colour palette – R output

Large version of figure 4.

Python Code

af_categorical_colours = [
'#12436D', # Dark blue
'#28A197', # Turquoise
'#801650', # Dark pink
'#F46A25', # Orange
'#3D3D3D', # Dark grey
'#A285D1' # Light purple
]

Python code for using the colour palette in a clustered bar chart

#Load your packages
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns

#Load in your data
clustered = pd.read_csv(datapath+"clustered.csv")

# Set up the colour palette with seaborn
af_categorial_colours = ["#12436D", "#28A197", "#801650", "#F46A25", "#3D3D3D", "#A285D1"]
af_categorial_palette = sns.color_palette(af_categorial_colours) # Colour palette object
# Set palette for plots that follow
sns.set_palette(af_categorial_palette)

# Create your chart
clustered_bar = sns.barplot(x = "Shop", y = "Value", data = clustered, hue = "Fruit",edgecolor = "white")
# Set axes labels
clustered_bar.set_xlabel("Shop")
clustered_bar.set_ylabel("")
# Add gridlines to the chart and remove frames to declutter
clustered_bar.grid(visible = True, which = "both", axis = "y", ccolor = ("#BEBEBE"))
clustered_bar.set_axisbelow(True)
clustered_bar.set_frame_on(False)
# Set the intervals and the colours of the ticklines
clustered_bar.set_yticks(np.arange(start = 0, stop = 51, step = 5))
clustered_bar.tick_params(color = "#BEBEBE")
clustered_bar.set_ylim(bottom = -0.5)
# Adjust the legend so it is in the same order as the bars for usability
clustered_bar.legend(frameon = False, loc = "upper left", ncol = 4, handlelength = 0.7,bbox_to_anchor = (0.025, 0.62, 0.5, 0.5))

Figure 5: Clustered bar chart using categorical data colour palette – Python output

The legend is presented in the same order as the bars in the clusters.

Larger version of figure 5.

Please note that the categorical colour palette appears darker when using the Seaborn package.

Python code for using the colour palette in a pie chart

This code creates custom labels for the pie chart, combining the category and percentage columns from our imported data into one label. This means they do not have to be located on the chart separately, so the label looks neater and is easier for users to read.

# Load your packages
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# Load in your data
pie_chart_data= pd.read_csv(datapath+"pie_data.csv")

# Set up the colour palette with seaborn
af_categorial_colours = ["#12436D", "#28A197", "#801650", "#F46A25", "#3D3D3D", "#A285D1"]
af_categorial_palette = sns.color_palette(af_categorial_colours) # Colour palette object
# Set palette for plots that follow
sns.set_palette(af_categorial_palette)

# First #Create custom labels for the pie chart
labels_religion = []
# Loop through the category and percentage columns on the dataset to link them together on one label
for each_religion in pie_chart_data["Religion"]:
labels_religion.append("{}\n{:.1f}%".format(
each_religion, # Formats our output to 1 d.p and add brackets to the percentage as best practice
list(pie_chart_data[pie_chart_data["Religion"] == each_religion]["Percentage"])[0]))

# Create your chart in matplotlib
figure, axes = plt.subplots(figsize=(6, 6))
axes.pie(x=pie_chart_data["Percentage"],
labels=labels_religion, #Uses the custom labels
labeldistance=1.2, startangle=90,counterclock=False,
textprops=dict(fontname = "Arial", color = "black", fontsize = 12, multialignment = "center"),
wedgeprops = {"edgecolor" : "white",'linewidth': 2,'antialiased': True})

Figure 6: Pie chart using categorical data colour palette – Python output

Larger version of figure 6.

Please note this example uses the Matplotlib package rather than Seaborn so the colours do not appear darker.

Microsoft theme file

We have created a categorical colour palette Microsoft theme file (THMX, 59KB) to help you implement this palette.

If you have any issues downloading the Microsoft theme file, please email Analysis.Function@ons.gov.uk.

Using the Microsoft theme file

Please note, the steps in these sections may differ depending on which version of Microsoft Office you have.

Steps to open our categorical colour theme in Microsoft PowerPoint:

  • Download the file.
  • Open your PowerPoint document or a blank document.
  • Select the ‘Design’ ribbon.
  • Select the drop down arrow in the ‘Themes’ box.
  • Select ‘Browse for Themes…’.
  • Search for where you downloaded the theme file to and select ‘Open’.

Steps to open our categorical colour theme in Microsoft Excel:

  • Download the file.
  • Open your Excel document or a blank document.
  • Select the ‘Page Layout’ ribbon.
  • Select the drop down arrow under ‘Themes’ on the left hand side.
  • Select ‘Browse for Themes…’.
  • Search for where you downloaded the theme file to and select ‘Open’.

Please note each time you open a new Excel document you will need to set the theme again.

How to open our categorical colour theme in Microsoft Word and set as default:

  • Download the file.
  • Open your Word document or a blank document.
  • Select the ‘Design’ ribbon.
  • Select the drop down arrow in the ‘Themes’ box.
  • Select ‘Browse for Themes…’.
  • Search for where you downloaded the theme file to and select ‘Open’.
  • Select the ‘Design’ ribbon again.
  • Select ‘Set as Default’ in the ‘Document Formatting’ box.
  • Select ‘Yes’ to the comment box.

If you are having issues downloading our theme file you can create your own using our categorical colour palette. If you do, ensure your chart backgrounds are white. Our categorical colour palette may not be accessible when used on a different colour background.

Adding our colours to a Microsoft theme in PowerPoint:

1. Open your current document or a new document.
2. In the ‘Design’ ribbon , select the drop down arrow in the ‘Variants’ box.
3. Hover over ‘Colours’ and then select on ‘Customize Colours…’.
4. Add in the following colours by selecting each drop down, selecting ‘Custom’ and pasting in the following hex codes:

Text/Backgrounds – Dark 1 = #000000
Text/Backgrounds – Light 1= #FFFFFF
Text/Backgrounds – Dark 2 = #000000
Text/Backgrounds – Light 2 = #FFFFFF
Accent 1 = #12436D
Accent 2 = #28A197
Accent 3 = #801650
Accent 4 = #F46A25
Accent 5 = #3D3D3D
Accent 6 = #A285D1
Hyperlink = #0563C1
Followed Hyperlink = #954F72

5. Name your colour palette “Categorical colour palette” and select save.

Set your background style

6. In the ‘Design’ ribbon again, select the drop down arrow in the ‘Variants’ box.
7. Hover over ‘Background Styles’.
8. Select style 1. This should be a plain white background. We must select this style as our categorical colour palette is not accessible when used on a different colour background.

Set your font style

9. In the ‘Design’ ribbon again, select the drop down arrow in the ‘Variants’ box.
10. Hover over ‘Fonts’ and select a font of your choice. Remember to choose a sans serif font. We recommend using Arial.

Save your new theme

11. In the ‘Design’ ribbon again, select the drop down arrow in the ‘Themes’ box.
12. Select ‘Save Current Theme…’.

Back to top of page

Duo colour palette

This is the palette we recommend for categorical data when there are two categories.

If there are two categories in your chart we recommend using the ‘dark blue’ and ‘orange’ from the categorical colour palette. This is because this is the pair of colours from the palette with the highest contrast ratio. For more information see our colours guidance.

Figure 7: Line chart using the duo colour palette

 

Larger version of figure 7. This line chart has two lines, one dark blue and one orange. It is made in Microsoft Excel. It uses fictional data about company revenue.

R Code

af_categorical_colours_2 <- c(
"#12436D", # Dark blue
"#F46A25" # Orange
)

#Load your packages
library(tidyverse)
library(ggplot2)
library(ggrepel)

#Load in your colours
af_categorical_colours_2 <- c("#12436D", "#F46A25")

#Load in your data
two_series_data <- read_csv("/two_series_data.csv")

#Create your chart
ggplot(two_series_data, aes(x = Year)) +
geom_line(aes (y = Company1), colour = (af_categorical_colours_2 [1] ), size = 1.1) +
geom_line(aes (y = Company2), colour = (af_categorical_colours_2 [2] ), size = 1.1) +
annotate("text", label = "Company 1", x = 2020, y = 58, size = 4.7) +
annotate("text", label = "Company 2", x = 2020, y = 38.8, size = 4.7) +
labs(x = "", y = "£ million") +
theme_classic(base_size = 18) +
coord_cartesian(expand = FALSE, clip = 'off') +
theme(axis.title.y = element_text(angle = 0), panel.grid.major.y = element_line("light grey"), legend.position="top", axis.line = element_line(FALSE), axis.ticks = element_line("light grey"), plot.margin = margin(0.5, 1.5, 0.1, 0.1, "cm")), panel.grid.minor = element_blank(),
panel.grid.major.x = element_blank(), panel.background = element_blank()) +
scale_y_continuous(limits=c(0,70), n.breaks = 6) +
scale_x_continuous(breaks = seq(2010, 2020, by = 1), labels = c(2010, "", 2012, "", 2014, "", 2016, "", 2018, "", 2020)) +

Figure 8: Line chart using duo colour palette – R output

Larger version of figure 8.

 

Python Code

af_categorical_colours_2 = [
'#12436D', # Dark blue
'#F46A25' # Orange
]

#Load your packages
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator
import seaborn as sns

#Load in your data
two_series= pd.read_csv(datapath+"two_series.csv")

# Set up the colour palette with seaborn
af_categorical_colours_2 = ["#F46A25", "#12436D"]
af_categorical_palette_2 = sns.color_palette(af_categorical_colours_2) # Colour palette object
# Set palette for plots that follow
sns.set_palette(af_categorical_palette_2)

# Create the chart
duo_lineplot = sns.lineplot(x = "Year", y = "value",data = two_series, hue = "Company",legend = False)
# Label the lines instead of using a legend
duo_lineplot.annotate("Company 1", xy = (two_series[two_series["Company"] == "Company1"]["Year"].max() + 0.2, two_series[(two_series["Company"] == "Company1") &(two_series["Year"] == two_series["Year"].max())]["value"]),color = "black")
duo_lineplot.annotate("Company 2",
xy = (two_series[two_series["Company"] == "Company2"]["Year"].max() + 0.2,two_series[(two_series["Company"] == "Company2") &(two_series["Year"] ==two_series["Year"].max())]["value"].max()),color = "black")
# Set axes labels and position
duo_lineplot.set_xlabel("Year")
duo_lineplot.set_ylabel("£ Million", rotation=0)
duo_lineplot.yaxis.set_label_coords(-0.1, 1.02)
# Gridlines and Frames
duo_lineplot.grid(visible = True, which = "both", axis = "y", color = (0.745, 0.745, 0.745))
duo_lineplot.set_axisbelow(True)
duo_lineplot.set_frame_on(False)
# Set the intervals and the colours of the ticklines
duo_lineplot.tick_params(color = "#BEBEBE", labelsize=14)
duo_lineplot.xaxis.set_minor_locator(AutoMinorLocator(2)) # Specify the number of minor ticks
duo_lineplot.xaxis.set_tick_params(which='minor')
duo_lineplot.set_ylim(bottom = -0.5, top = 70) #to get a 0 line

Figure 9: Line chart using duo colour palette – Python output

Larger version of figure 9

Back to top of page

Sequential data colour palette

When to use the sequential data colour palette

Use this colour palette for sequential data. This is any sort of data where the order has some meaning. For example, age groups.

Palette table

Note: the cells in the ‘Example of colour’ column may appear blank to screen reader software. They contain a colour fill, but no data.

ColourHex codeRGB codeCYMK codeExample of colour
Dark blue#12436D(18, 67, 109)(83, 39, 0, 57)
Mid blue#2073BC(32, 115, 188)(83, 39, 0, 26)
Light blue#6BACE6(107, 172, 230) (53, 25, 0, 10)

Figure 10: Clustered bar chart using the sequential data colour palette

The legend is presented in the same order as the bars in the clusters.

Larger version of figure 10.

This chart was made in Microsoft Excel. It uses fictional data about the age of shoppers.

Note: This is the only time we advise to use borders around the bars. This is because, to use a sequential colour palette you have to use a light colour for one of the bars. This light colour does not have enough contrast with the white background. A border allows people to see the size of the bar even if they cannot see the colour fill. We put a border around the bars with a darker colour fill for consistency.

R Code

af_sequential_colours <- c(
"#12436D", # Dark blue
"#2073BC", # Mid blue
"#6BACE6" # Light blue
)

#Load your packages
library(tidyverse)
library(ggplot2)

#Load in your colours
af_sequential_colours <- c("#12436D", "#2073BC", "#6BACE6")

#Load in your data
sequential <- read_csv("/sequential_bars.csv")

#Create your chart
ggplot(sequential, aes(fill = Age, y = Value, x = Shop)) +
geom_col(width = 0.6, (af_sequential_colours [1] ), position = position_dodge(0.7)) +
labs(x = "", y = "") +
scale_y_continuous(limits=c(0,60), n.breaks = 6) +
theme_classic(base_size = 18) +
theme(panel.grid.major.y = element_line("light grey"), legend.position="top", axis.line = element_line(FALSE), axis.ticks = element_line(FALSE)) +
scale_fill_manual(values = c(af_sequential_colours), name = "")

Figure 11: Clustered bar chart using the sequential data colour palette – R output

The legend is presented in the same order as the bars in the clusters.

Larger version of figure 11.

Python code

 

af_sequential_colours = [
"#12436D", # Dark blue
"#2073BC", # Mid blue
"#6BACE6" # Light blue
]

In this code we have set the colours manually and defined spacing using Matplotlib rather than using the Seaborn colour palette function. This is because we advise that there should be gaps within the clusters on the bar chart, as well as between the clusters. This makes it easier to tell the bars apart. When using Seaborn the chart does not have sufficient spacing between the bars when a border is used.

If you have been able to troubleshoot this issue, please let us know at Analysis.Function@ons.gov.uk

#Load your packages
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

#Load in your data
sequential= pd.read_csv(datapath+"sequential_bars.csv")

# Arrange the categories on your chart
names = sequential['Shop'].values
x = np.arange(len(names))
# Set colours for each of the categories, the border colour and spacing
plt.bar(x-0.25, sequential['0 to 25'].values, width=0.19, edgecolor='#12436D', label='0 to 25',zorder=2,color="#12436D")
plt.bar(x, sequential['26 to 64'].values, width=0.19, edgecolor='#12436D', label='26 to 64',zorder=2, color="#2073BC")
plt.bar(x+0.25, sequential['65 and over'].values, width=0.19, edgecolor='#12436D', label='65 and over',zorder=2, color="#6BACE6")

# Set intervals and colours of the ticklines
plt.xticks(x, names)
#plt.yticks(np.arange(0, 65, 10))
plt.tick_params(color ="white")
plt.ylim(bottom = -0.5, top=60)
# Gridlines and Frames
plt.box(False)
plt.grid(b = True, which = "both", axis = "y", color = (0.745, 0.745, 0.745))
# Adjust the legend so it is in the same order as the bars for usability
plt.legend(bbox_to_anchor=(0.025, 0.62, 0.5, 0.5), loc = "upper left", ncol = 4, handlelength = 0.7,frameon=False)

Figure 12: Clustered bar chart using the sequential data colour palette – Python output

The legend is presented in the same order as the bars in the clusters.

Larger version of figure 12.

  1. Open your Microsoft document and create the chart type you wish.
  2. Select the first chart object on your chart, this may be a first bar, top line or top pie chart segment.
  3. Right click and select the ‘Fill’ button.
  4. Select ‘More Fill Colours…’
  5. Select on ‘Custom’.
  6. Add in the the hex code ‘#12436D’ to the hex code box at the bottom and click ‘OK’.
  7. Repeat steps 2 to 6 for the next chart object using the hex code #2073BC.
  8. Repeat steps 2 to 6 for the final chart object using the hex code #6BACE6.

Back to top of page

Focus chart colour palette

When to use the focus chart colour palette

Use this colour palette when you want to highlight specific elements to help users understand the information. This is called a focus chart.

Palette table

Note: the cells in the ‘Example of colour’ column may appear blank to screen reader software. They contain a colour fill, but no data.

ColourHex codeRGB codeCYMK codeExample of colour
Dark blue#12436D(18, 67, 109)(83, 39, 0, 57)
Grey #BFBFBF(191, 191, 191)(0, 0, 0, 25)

Figure 13: Line chart using the focus chart colour palette

Larger version of figure 13.

This chart is made in Microsoft Excel. All the lines are light grey, except the line showing the UK’s time series. This is in dark blue and stands out.

It uses data on Covid-19 cases per million people.

Source: Coronavirus (COVID-19) cases taken from Our World in Data

R Code

af_focus_colours <- c(
"#12436D", # Dark blue
"#BFBFBF" # Grey
)

#Install package
install.packages("scales")

#Load your packages
library(tidyverse)
library(ggplot2)
library("scales")

#Load your colours
af_focused_colours <- c("#12436D", "#BFBFBF")
af_focused_assigned <- c("United Kingdom" = af_focused_colours[1] , "Austria" = af_focused_colours[2],
"Belgium" = af_focused_colours[2], "Netherlands" = af_focused_colours[2],
"Germany" = af_focused_colours[2], "France" = af_focused_colours[2],
"Italy" = af_focused_colours[2], "Spain" = af_focused_colours[2])

#Load in your data
focus_data <- read_csv("/focus_data.csv")
focus_data$Date <- as.Date(focus_data$Date, "%d/%m/%Y")

#Create your chart
ggplot(focus_data, aes(x = Date, y = Value, colour = factor(Country), group = Country)) +
geom_line(size = 1) +
scale_colour_manual(values = af_focused_assigned) +
labs(x = "", y = "") +
scale_y_continuous(limits=c(0,1400), n.breaks = 8, labels = comma) +
scale_x_date(breaks = as.Date(c("2021-08-01", "2021-08-21", "2021-09-10", "2021-09-30", "2021-10-20","2021-11-09")), date_labels = "%d%b") +
geom_text(data = filter(focus_data, Date == max(Date)), aes(label = Country), hjust = 0, nudge_x = 0.6, colour = "black") +
coord_cartesian(expand = FALSE, clip = 'off') +
theme_classic(base_size = 18) +
theme(panel.grid.major.y = element_line("light grey")) +
theme(axis.line = element_line(FALSE), axis.ticks = element_line("light grey"), legend.position = 'none', plot.margin = margin(0.5, 2.8, 0.1, 0.1, "cm"))

Figure 14: Line chart using focus chart colour palette – R output

Larger version of figure 14.

 

Python Code

af_focus_colours = [
"#12436D", # Dark blue
"#BFBFBF" # Grey
]

#Load your packages
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns

#Load in your data
focus= pd.read_csv(datapath+"focus_data.csv")

# Set a rule to create a focus palette for your chart, so all countries except United Kingdom are the same colour
focus_palette = {C:"#12436D" if C=="United Kingdom" else "#BFBFBF" for C in focus.Country.unique()}

# Create the plot
focus_plot = sns.lineplot(x = "Date", y = "Value", data = focus,
hue = "Country", palette=focus_palette,
legend = False))

# Create a loop to plot all the countries
for each_country in focus["Country"].unique():
focus_plot.annotate(each_country,
xy = (focus[focus["Country"] == each_country]
["Date"].max() + 0.5,
focus[(focus["Country"] == each_country)
& (focus["Date"] == focus["Date"].max())]
["Value"].max()))

# Set x-axis labels to custom dates we require and set position
focus_plot.set(xlabel=None, ylabel=None)
focus_plot.set(xticks=([0, 20, 45, 65, 85 105]))
focus_plot.set_xticklabels(["01 Aug","21 Aug","10 Sep","30 Sept", "20 Oct","09 Nov"])
# Gridlines and Frames
focus_plot.grid(visible = True, which = "both", axis = "y", color = "#BEBEBE")
focus_plot.set_axisbelow(True)
focus_plot.set_frame_on(False)
# Set the axis tick position as well as the colours of the ticklines
focus_plot.xaxis.set_tick_params(color = "white")
focus_plot.yaxis.set_tick_params(color = "#BEBEBE")
focus_plot.set_ylim(bottom = -0.5, top = 1400) # to get a 0 line

Figure 15: Line chart using focus chart colour palette – Python output

Larger version of figure 15

  1. Open your Microsoft document and create the chart type you wish.
  2. Select the chart object you are focusing on, this may be a significant bar, line or pie chart segment.
  3. Right click and select the ‘Fill’ button.
  4. Select ‘More Fill Colours…’
  5. Select on ‘Custom’.
  6. Add in the the hex code ‘#12436D’ to the hex code box at the bottom and click ‘OK’.
  7. Next individually select all other chart objects (bars, lines or segments) which you are not focused on.
  8. Right click and select the ‘Fill’ button.
  9. Select ‘More Fill Colours…’
  10. Select on ‘Custom’.
  11. Add in the the hex code ‘#BFBFBF’ to the hex code box at the bottom and click ‘OK’.
  12. Repeat steps 7 to 11 until all of the non focus object are the same colour.

Back to top of page

R and Python colour palette packages

The Analysis Standards and Pipelines (ASAP) team have also created packages in Python and R for the colour palettes.

They are open source and available for anyone across government to use when creating data visualisations. It will be great for those working in DAP and they will eliminate the need for copy and pasting codes from the webpage.

For more information on how to install and use them, please read the R afcolours documentation, or py_af_colours documentation if you are using Python.

Please get in touch if you have any questions or feedback, by emailing Analysis.Function@ons.gov.uk.

Back to top of page

Related links

Analysis Function guidance and e-learning

Other links

Back to top of page

Any questions?

If you have any further questions you can:

Back to top of page
  • If you would like us to get in touch with you then please leave your contact details or email Analysis.Function@ons.gov.uk directly.
  • This field is for validation purposes and should be left unchanged.