Update : Figure Friday 2024 - week 33 is the newer dataset.
Week 32 of the Figure Friday initiative will focus on the Gender Pay Gap in Ireland.
Jennifer Keane collected data from 2022-2023 to report on pay differences for men versus women among companies located in Ireland. More on the data and project can be found at the Irish Gender Pay Gap Portal and at the project GitHub.
Sample Figure:
Code for sample figure:
import plotly.graph_objects as go
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/Figure-Friday/main/2024/week-32/irish-pay-gap.csv')
# Filter the data for certain companies
df_filtered = df[df['Company Name'].isin(['3M', 'AA', 'Abbott Ireland (all legal entities)', 'AbbVie Sligo' 'AbbVie Westport (Allergan)',
'ABP Food Group: C&D Foods', 'ABP Food Group: Irish Country Meats', 'Abtran',
'Google Ireland Limited', 'Meta Ireland (all legal entities)'])]
# Get the list of unique companies
companies = df_filtered['Company Name'].unique()
# Prepare data for the dumbbell plot
data = {"line_x": [], "line_y": [], "2022": [], "2023": [], "companies": []}
for company in companies:
data["companies"].append(company)
mean_gap_2022 = df_filtered.loc[
(df_filtered['Report Year'] == 2022) & (df_filtered['Company Name'] == company), 'Mean Hourly Gap'].values
mean_gap_2023 = df_filtered.loc[
(df_filtered['Report Year'] == 2023) & (df_filtered['Company Name'] == company), 'Mean Hourly Gap'].values
if len(mean_gap_2022) > 0 and len(mean_gap_2023) > 0:
data["2022"].append(mean_gap_2022[0])
data["2023"].append(mean_gap_2023[0])
data["line_x"].extend([mean_gap_2022[0], mean_gap_2023[0], None])
data["line_y"].extend([company, company, None])
# Create the dumbbell plot
fig = go.Figure(
data=[
go.Scatter(
x=data["line_x"],
y=data["line_y"],
mode="lines",
showlegend=False,
marker=dict(color="grey")
),
go.Scatter(
x=data["2022"],
y=data["companies"],
mode="markers",
name="2022",
marker=dict(color="green", size=10)
),
go.Scatter(
x=data["2023"],
y=data["companies"],
mode="markers",
name="2023",
marker=dict(color="blue", size=10)
),
]
)
fig.update_layout(
title="Mean Hourly Gap by Company: 2022 vs 2023",
height=1000,
legend_itemclick=False,
xaxis_title="Mean Hourly Gap",
yaxis_title="Company"
)
fig.show()
Participation Instructions:
- Create - use the weekly data set to build your own Plotly visualization or Dash app. Or, enhance the sample figure provided in this post, using Plotly or Dash.
- Submit - post your creation to LinkedIn or Twitter with the hashtags
#FigureFriday
and#plotly
by midnight Thursday, your time zone. Please also submit your visualization as a new post in this thread. - Celebrate - join the Figure Friday sessions to showcase your creation and receive feedback from the community.
If you prefer to collaborate with others on Discord, join the Plotly Discord channel .
Thank you to the Irish Gender Pay Gap Portal for the data.