File:Womens hour records progression.svg
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this PNG preview of this SVG file: 800 × 463 pixels. Other resolutions: 320 × 185 pixels | 640 × 370 pixels | 1,024 × 593 pixels | 1,280 × 741 pixels | 2,560 × 1,482 pixels | 1,142 × 661 pixels.
Original file (SVG file, nominally 1,142 × 661 pixels, file size: 95 KB)
File information
Structured data
Captions
Any autoconfirmed user can overwrite this file from the same source. Please ensure that overwrites comply with the guideline.
Contents
Summary
[edit]DescriptionWomens hour records progression.svg |
English: The progression of the UCI Hour Record in cycling for Women, broken up into the three currently recognized categories:
|
||
Date | |||
Source | Own work | ||
Author | Falcorian | ||
SVG development InfoField | This plot was created with Matplotlib. | ||
Source code InfoField | Python code#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
# In[2]:
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
# In[3]:
# Set plotting style
plt.style.use("seaborn-v0_8-white")
RECORD_TO_TEXT = {
"uci": "UCI Record",
"best": "Best Human Effort",
"unified": "Unified Record",
}
CURRENT_PALLETE = sns.color_palette()
PLOT_COLORS = {
"uci": CURRENT_PALLETE[0],
RECORD_TO_TEXT["uci"]: CURRENT_PALLETE[0],
"best": CURRENT_PALLETE[1],
RECORD_TO_TEXT["best"]: CURRENT_PALLETE[1],
"unified": CURRENT_PALLETE[2],
RECORD_TO_TEXT["unified"]: CURRENT_PALLETE[2],
}
WIDTH = 12
HEIGHT = 7
get_ipython().run_line_magic('matplotlib', 'inline')
# # Load the data
#
# I have already scraped the HTML, read it into Pandas, and cleaned it up. So I'll just load that cleaned data.
# In[4]:
df = pd.read_json("./hour_record_dataframe.json", orient="table")
# In[5]:
# Rename some riders who have *REALLY* long names
df = df.replace(
{
"Leontien Zijlaard-van Moorsel": "Leontien van Moorsel",
"Molly Shaffer Van Houweling": "Molly Van Houweling",
}
)
# In[6]:
df.head()
# # Plotting
# In[7]:
def draw_bands(ax, ticks=None):
"""Add grey bands to the plot.
Args:
ax: a matplotlib axes object.
ticks: a list of tick postions, to use instead of the ones that come
with ax.
"""
if ticks is None:
ticks = ax.get_xticks(minor=False)
for i in range(0, len(ticks), 2):
# Check for the end of the array
if i >= len(ticks) or i + 1 >= len(ticks):
return
# Draw a band
left_tick = ticks[i]
right_tick = ticks[i + 1]
plt.axvspan(left_tick, right_tick, color="0.97", zorder=-2)
ticks = ax.get_xticks(minor=False)
# In[8]:
def draw_legend(plt):
"""Draw the legend on the specified plot.
Args:
plt (matplotlib.pyplot): pyplot object
"""
leg = plt.legend(
loc="upper left",
fontsize=18,
ncol=1,
frameon=1,
fancybox=True,
# The bellow commands remove the lines in the legend
handlelength=0,
handletextpad=0,
markerscale=0,
)
# Turn on and theme the frame
frame = leg.get_frame()
frame.set_linewidth(1)
frame.set_alpha(1)
frame.set_facecolor("white")
frame.set_edgecolor("black")
# Set the legend text color to match the line color
handles, _ = ax.get_legend_handles_labels()
texts = leg.get_texts()
for _, text in zip(handles, texts):
text.set_color(PLOT_COLORS[text.get_text()])
fig.tight_layout()
# In[9]:
def annotate_point_with_name(row, color, nudges):
rider = row["rider"]
distance = row["distance (km)"]
date = row["date"]
text = f"{rider} ({distance} km) "
# Try to get nudges
adjust = nudges.get((rider, distance), (0, 0))
x_adjust = adjust[0] * 365.0 # Convert to years
x_pos = date + pd.to_timedelta(x_adjust, unit="D")
y_pos = distance + adjust[1]
plt.text(
x_pos,
y_pos,
text,
horizontalalignment="right",
verticalalignment="center",
color=color,
fontsize=16,
fontweight="bold",
)
# In[10]:
def plot_steps_and_markers(df, nudges, ax):
plt.sca(ax)
for record in df["record"].unique():
color = PLOT_COLORS[record]
df_tmp = df[df["record"] == record]
heights = list(df_tmp["distance (km)"].values)
years = list(df_tmp["date"].values)
# Find out when the unified record became superior to this record
r = heights[-1]
df_uni = df[(df["record"] == "unified") & (df["distance (km)"] >= r)]
limit = min(df_uni["date"])
# Extend up to that date
heights += [heights[-1]]
years += [limit]
plt.step(
x=years,
y=heights,
where="post",
linewidth=2.5,
color=color,
label=RECORD_TO_TEXT[record],
)
plt.plot(years[:-1], heights[:-1], "o", color=color, markersize=10)
for index, row in df_tmp.iterrows():
annotate_point_with_name(row, color, nudges)
# In[11]:
df_men = df[(df["gender"] == "men") & (df["success"] == True)]
fig, ax = plt.subplots(figsize=(WIDTH, HEIGHT))
annotation_nudge = {
("Eddy Merckx", 49.431): (9, 0.25),
("Chris Boardman", 49.441): (4, 0.25),
("Ondřej Sosenka", 49.7): (5, 0.33),
("Tony Rominger", 55.291): (0.2, -0.36),
}
ax.set_ylabel("Distance (km)", fontsize=20)
plt.title("Men's Hour Record Progression", fontsize=30)
plot_steps_and_markers(df_men, annotation_nudge, ax)
ax.tick_params(axis="both", which="major", labelsize=16)
draw_bands(ax)
draw_legend(ax)
_, x_current = ax.get_xlim()
ax.set_xlim("1966-01-01", x_current)
ticks = ax.get_xticks()
fig.patch.set_facecolor("white")
# Save to disk
for ext in ("png", "svg"):
fig.savefig(
"/tmp/mens_hour_records_progression.{ext}".format(ext=ext),
bbox_inches="tight",
transparent=False,
)
# In[12]:
df_women = df[(df["gender"] == "women") & (df["success"] == True)]
fig, ax = plt.subplots(figsize=(WIDTH, HEIGHT))
annotation_nudge = {
("Maria Cressari", 41.471): (10, -0.27),
("Keetie van Oosten", 43.082): (18.5, -0.25),
("Jeannie Longo-Ciprelli", 44.767): (21.0, -0.25),
("Jeannie Longo-Ciprelli", 45.094): (21.0, -0.25),
("Leontien van Moorsel", 46.065): (20.3, -0.25),
("Jeannie Longo-Ciprelli", 44.933): (0, 0.25),
("Yvonne McGregor", 47.411): (1.5, 0.3),
("Jeannie Longo-Ciprelli", 48.159): (3, 0.3),
("Catherine Marsal", 47.112): (0, -0.15),
("Molly Van Houweling", 46.273): (0, 0.1),
("Evelyn Stevens", 47.98): (0, -0.1),
("Vittoria Bussi", 48.007): (3, 0.35),
("Joscelin Lowden", 48.405): (0.5, 0.35),
}
ax.set_ylabel("Distance (km)", fontsize=20)
plt.title("Women's Hour Record Progression", fontsize=30)
plot_steps_and_markers(df_women, annotation_nudge, ax)
ax.tick_params(axis="both", which="major", labelsize=16)
draw_bands(ax, ticks[1:-1])
draw_legend(ax)
ax.set_ylim(41, 50.5)
fig.patch.set_facecolor("white")
# Save to disk
for ext in ("png", "svg"):
fig.savefig(
"/tmp/womens_hour_records_progression.{ext}".format(ext=ext),
bbox_inches="tight",
transparent=False,
)
Data
|
Licensing
[edit]
I, the copyright holder of this work, hereby publish it under the following licenses: This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International, 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic license.
You may select the license of your choice. |
|||
|
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 22:42, 27 October 2024 | 1,142 × 661 (95 KB) | Rz98 (talk | contribs) | Got rid of "dots" in legend | |
18:13, 27 October 2024 | 1,142 × 661 (96 KB) | Rz98 (talk | contribs) | Updated with Vittoria Bussi's record from Oct 2023 | ||
21:45, 21 August 2022 | 1,071 × 622 (91 KB) | Falcorian (talk | contribs) | Update to 2022 | ||
19:14, 24 October 2021 | 1,072 × 620 (88 KB) | Falcorian (talk | contribs) | Oops, uploaded old version, this is the new, fixed version | ||
19:11, 24 October 2021 | 1,071 × 620 (105 KB) | Falcorian (talk | contribs) | Remove bullet points from legend | ||
18:50, 24 October 2021 | 1,072 × 620 (89 KB) | Falcorian (talk | contribs) | Update for current progress as of 2021-10-24. | ||
04:55, 3 June 2019 | 1,071 × 620 (105 KB) | Falcorian (talk | contribs) | == {{int:filedesc}} == {{Information |description={{en|1=The progression of the UCI Hour Record in cycling for Women, broken up into the three currently recognized categories: {{legend|#1f77b4|UCI Hour Record}} {{legend|#ff7f0e|UCI Best Human Effort}} {{legend|#2ca02c|UCI Unified Record}} Data is from English Wikipedia Hour Record Article. }} |source={{own}} |author=Falcorian |date=2019-06-02 |other fields={{Igen|Matplotlib|+|code= # -*- coding:... |
You cannot overwrite this file.
File usage on Commons
The following 4 pages use this file:
File usage on other wikis
The following other wikis use this file:
- Usage on de.wikipedia.org
- Usage on en.wikipedia.org
- Usage on fr.wikipedia.org
- Usage on ja.wikipedia.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Width | 856.69875pt |
---|---|
Height | 495.760625pt |