Fichier:BassetlawGraph.svg
Fichier d’origine (Fichier SVG, nominalement de 512 × 267 pixels, taille : 42 kio)
Ce fichier et sa description proviennent de Wikimedia Commons.
Description
DescriptionBassetlawGraph.svg |
English: United Kingdom general election results for Bassetlaw constituency. |
Date | |
Source | Travail personnel |
Auteur | JeremyA |
Notes
The Background colour indicates the party of the sitting MP at any given year.
Graph drawn with R
Parties:
- Conservative = Conservative Party (1885–1918; 1964–present); Conservative and Liberal Unionist (1922–1959).
- Labour = Labour Party
- Liberal = Liberal Party (1885–1979); SDP-Liberal Alliance (1983–1987); Liberal Democrats (1992–present).
Data:
Year | Conservative | Labour | Liberal | Other |
---|---|---|---|---|
1885.96 | 51.7 | NA | 48.3 | NA |
1886.57 | NA | NA | NA | NA |
1890 | 54.5 | NA | 45.5 | NA |
1892.57 | 52.4 | NA | 47.6 | NA |
1895.6 | 57.4 | NA | 42.6 | NA |
1900.81 | NA | NA | NA | NA |
1906.61 | 47.4 | NA | 52.6 | NA |
1910.11 | 51.6 | NA | 48.4 | NA |
1910.97 | 51 | NA | 49 | NA |
1918.95 | NA | NA | NA | NA |
1922.87 | 55.2 | 44.8 | NA | NA |
1923.93 | 42.3 | 28.3 | 29.4 | NA |
1924.83 | 46.3 | 41 | 12.7 | NA |
1929.41 | 41.3 | 58.7 | NA | NA |
1931.82 | NA | 33.36 | NA | 66.64 |
1935.87 | NA | 51.33 | NA | 48.67 |
1945.51 | 37.21 | 62.79 | NA | NA |
1950.148 | 32.16 | 57.64 | 10.2 | NA |
1951.82 | 39.29 | 60.71 | NA | NA |
1955.4 | 41.89 | 58.11 | NA | NA |
1959.77 | 41.97 | 58.03 | NA | NA |
1964.79 | 40.97 | 59.03 | NA | NA |
1966.25 | 38.37 | 61.63 | NA | NA |
1968 | 47.92 | 49.64 | NA | 2.44 |
1970.46 | 39.21 | 54.87 | 5.92 | NA |
1974.16 | 40.01 | 59.99 | NA | NA |
1974.78 | 30.9 | 53.69 | 14.65 | 0.76 |
1979.34 | 37.97 | 50.23 | 11.8 | NA |
1983.44 | 37.74 | 45.6 | NA | 16.66 |
1987.44 | 37.47 | 48.1 | NA | 14.43 |
1992.27 | 35 | 53.4 | 11.6 | NA |
1997.33 | 24.7 | 61.1 | 10.3 | 3.8 |
2001.43 | 30.2 | 55.3 | 12.7 | 1.8 |
2005.34 | 29.8 | 56.6 | 13.6 | NA |
2010.35 | 33.9 | 50.5 | 11.2 | 4.4 |
2015.35 | 30.7 | 48.6 | 2.7 | 18 |
2017.44 | 43.3 | 52.6 | 2.2 | 1.9 |
Code:
The graph was produced with R. The following code will reproduce the graph using the data on this page.
library(tidyverse)
library(htmltab)
library(lubridate)
election_graph <- function(pageURL) {
election <- htmltab(pageURL,
which = 2,
rm_nodata_cols = F)
election <- as.tibble(lapply(election, function(x) {gsub("unopp", "100", x)}))
tidy_election <- gather(election, "Party", "Votes", 2:length(election))
tidy_election$Year <- as.numeric(tidy_election$Year)
tidy_election$Party <- factor(tidy_election$Party, levels = c("Conservative", "Labour", "Liberal", "Green", "SNP", "UKIP", "Other"))
tidy_election$Votes <- as.numeric(tidy_election$Votes)
election_victor <- tidy_election %>% filter(is.na(Votes) == FALSE) %>% group_by(Year) %>% summarize(Party = Party[which(Votes == max(Votes))])
election_victor$Year <- as.numeric(election_victor$Year)
election_victor$start_year <- election_victor$Year
election_victor$end_year <- c(election_victor$Year[-1], ceiling(election_victor$Year[length(election_victor$Year)] + 1))
election_victor[1,3] <- floor(election_victor[1,3] - 1)
tidy_election$Votes <- as.numeric(sapply(tidy_election$Votes, function(x) {gsub(100, NA, x)}))
party_colours <- c("#0087DC", "#DC241F", "#FAA61A", "#008066", "#FFF95D", "#EFE600", "dark grey")
names(party_colours) <- c("Conservative", "Labour", "Liberal", "Green", "SNP", "UKIP", "Other")
ggplot(tidy_election) +
geom_rect(data = election_victor,
aes(xmin = start_year,xmax = end_year, ymin = -Inf, ymax = Inf, fill = Party),
alpha = 0.35,
show.legend = F) +
geom_line(aes(x = Year, y = Votes, colour = Party), size = 0.703) +
geom_point(aes(x = Year, y = Votes, colour = Party)) +
geom_hline(yintercept = 100, color="black", size = 1.5) +
geom_vline(xintercept = 2019, color="black", size = 1.5) +
scale_colour_manual(values = party_colours) +
scale_fill_manual(values = party_colours) +
theme(text = element_text(color="black", size = 14),
axis.text = element_text(color="black", size = 11),
axis.line.x = element_line(color="black", size = 0.703),
axis.ticks.x = element_line(color="black", size = 0.703),
axis.line.y = element_line(color="black", size = 0.703),
axis.ticks.y = element_line(color="black", size = 0.703),
axis.ticks.length = unit(5, "points"),
panel.grid.major = element_line(color="blue", size = 0.5, linetype = 3),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
legend.position = c(.98, .97),
legend.direction = "horizontal",
legend.text = element_text(color="black", size = 11),
legend.title=element_blank(),
legend.justification = c("right", "top"),
legend.box.just = "right",
legend.key = element_blank(),
legend.background = element_rect(fill = "white", colour = "black"),
legend.margin = margin(0, 4, 4, 4)) +
scale_x_continuous(expand = c(0, 0), limits = c(election_victor[[1,3]], election_victor$end_year[length(election_victor$end_year)]), breaks = seq(1890, 2010, 10)) +
scale_y_continuous(expand = c(0, 0), limits = c(0, 100), breaks = seq(0, 100, 20)) +
labs(x = "Year", y = "Percentage Vote")
}
election_graph("https://commons.wikimedia.org/wiki/File:BassetlawGraph.svg")
ggsave("BassetlawGraph.svg", device = "svg", units = "cm", width = 20, height = 11, dpi = 120)
Conditions d’utilisation
- Vous êtes libre :
- de partager – de copier, distribuer et transmettre cette œuvre
- d’adapter – de modifier cette œuvre
- Sous les conditions suivantes :
- paternité – Vous devez donner les informations appropriées concernant l'auteur, fournir un lien vers la licence et indiquer si des modifications ont été faites. Vous pouvez faire cela par tout moyen raisonnable, mais en aucune façon suggérant que l’auteur vous soutient ou approuve l’utilisation que vous en faites.
- partage à l’identique – Si vous modifiez, transformez, ou vous basez sur cette œuvre, vous devez distribuer votre contribution sous la même licence ou une licence compatible avec celle de l’original.
Éléments décrits dans ce fichier
dépeint
Valeur sans élément de Wikidata
15 juin 2017
image/svg+xml
61ab71577deaf325b1ec0405a6fea9e3c6bef54b
42 661 octet
267 pixel
512 pixel
Historique du fichier
Cliquer sur une date et heure pour voir le fichier tel qu'il était à ce moment-là.
Date et heure | Vignette | Dimensions | Utilisateur | Commentaire | |
---|---|---|---|---|---|
actuel | 18 octobre 2020 à 05:55 | 512 × 267 (42 kio) | Chessrat | 2019 update | |
16 juin 2017 à 04:05 | 512 × 282 (40 kio) | JeremyA | User created page with UploadWizard |
Utilisation du fichier
La page suivante utilise ce fichier :
Usage global du fichier
Les autres wikis suivants utilisent ce fichier :
- Utilisation sur en.wikipedia.org
Métadonnées
Ce fichier contient des informations supplémentaires, probablement ajoutées par l'appareil photo numérique ou le numériseur utilisé pour le créer.
Si le fichier a été modifié depuis son état original, certains détails peuvent ne pas refléter entièrement l'image modifiée.
Largeur | 100% |
---|---|
Hauteur | 100% |