File:Tdf prize money in 2013 euro.svg
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this PNG preview of this SVG file: 780 × 600 pixels. Other resolutions: 312 × 240 pixels | 624 × 480 pixels | 999 × 768 pixels | 1,280 × 984 pixels | 2,560 × 1,969 pixels | 970 × 746 pixels.
Original file (SVG file, nominally 970 × 746 pixels, file size: 43 KB)
File information
Structured data
Captions
Contents
Summary
[edit]DescriptionTdf prize money in 2013 euro.svg |
English: The amount of prize money awarded in the Tour de France from it's beginning to 2013, adjusted to 2013 Euro. The two lines are:
|
||
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
from matplotlib.ticker import FuncFormatter
# In[2]:
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
# In[3]:
# Set plotting style
plt.style.use("seaborn-white")
WIDTH = 12
HEIGHT = 9
prop_cycle = plt.rcParams['axes.prop_cycle']
DEFAULT_COLORS = prop_cycle.by_key()['color']
get_ipython().run_line_magic('matplotlib', 'inline')
# # Helper functions
# In[4]:
def number_formatter(number, pos=None):
"""Convert a number into a human readable format.
Via https://flynn.gg/blog/better-matplotlib-charts/"""
magnitude = 0
while abs(number) >= 1000:
magnitude += 1
number /= 1000.0
return "€%.0f %s" % (number, ["", "K", "M", "B", "T", "Q"][magnitude])
# In[5]:
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)
# In[6]:
def draw_legend(plt):
"""Draw the legend on the specified plot.
Args:
plt (matplotlib.pyplot): pyplot object
"""
leg = plt.legend(
loc="upper left",
fontsize=24,
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.2)
frame.set_alpha(1)
frame.set_facecolor("white")
frame.set_edgecolor("black")
# Set the legend text color to match the line color
lines = leg.get_lines()
texts = leg.get_texts()
for line, text in zip(lines, texts):
text.set_color(line.get_color())
# # Load the data
# In[7]:
df = pd.read_json("./data/tdf_prizes_dataframe.json", orient="table")
# In[8]:
x = df.index
y_tot = df["total_adjusted_euro"]
y_first = df["first_prize_adjusted_euro"]
# # Make the plot
# In[9]:
fig, ax = plt.subplots(figsize=(WIDTH, HEIGHT))
# Plot the data
LINEWIDTH = 3
STEP_WHERE = "post"
plt.step(x, y_tot, where=STEP_WHERE, linewidth=LINEWIDTH, label="Total prize money")
plt.step(x, y_first, where=STEP_WHERE, linewidth=LINEWIDTH, label="Winner's prize money")
plt.yscale("log")
# Set titles
plt.figtext(0.5, 0.95, "Tour de France Prize Money", fontsize=34, ha="center")
plt.figtext(0.5, 0.9, "In 2013 Euro", fontsize=24, ha="center")
ax.set_ylabel(None)
ax.set_xlabel(None)
ax.set_xlim("1901", "2015")
ax.tick_params(axis="y", which="major", labelsize=28)
ax.tick_params(axis="x", which="major", labelsize=22)
ax.yaxis.set_major_formatter(FuncFormatter(number_formatter))
ax.yaxis.grid() # horizontal lines
plt.xticks(ticks=[str(yr) for yr in range(1910, 2020, 20)])
draw_bands(ax, [str(yr) for yr in range(1900, 2020, 10)])
draw_legend(plt)
# Save to disk
for ext in ("png", "svg"):
fig.savefig(
"/tmp/tdf_prize_money_in_2013_euro.{ext}".format(ext=ext), bbox_inches="tight"
)
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 | 05:29, 25 November 2019 | 970 × 746 (43 KB) | Falcorian (talk | contribs) | Make the plot slightly taller. | |
00:03, 24 November 2019 | 970 × 598 (43 KB) | Falcorian (talk | contribs) | Remove dots from legend. | ||
00:02, 24 November 2019 | 970 × 598 (44 KB) | Falcorian (talk | contribs) | == {{int:filedesc}} == {{Information |description={{en|1=The amount of prize money awarded in the Tour de France from it's beginning to 2013, adjusted to 2013 Euro. The two lines are: {{legend|#1f77b4|Total prize money}} {{legend|#ff7f0e|Winner's prize money}} Data is from [https://www.bikeraceinfo.com/tdf/tdf-prizes.html]. }} |source={{own}} |author=Falcorian |date=2019-11-23 |other fields={{Igen|Matplotlib|+|code= #!/usr/bin/env python # coding: utf-8 # In[1]: impor... |
You cannot overwrite this file.
File usage on Commons
The following 2 pages use this file:
File usage on other wikis
The following other wikis use this file:
- Usage on ar.wikipedia.org
- Usage on en.wikipedia.org
- Usage on tr.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 | 776.238125pt |
---|---|
Height | 596.95625pt |