File:Opinion polling for the 2016 Russian legislative election.svg

Original file(SVG file, nominally 1,728 × 768 pixels, file size: 243 KB)

Summary

Description
English: Opinion polling for the 2016 Russian legislative election using local regressions (LOESS)
Code template: https://gitlab.com/gbuvn1/opinion-polling-graph
ggplot.R
Sys.setlocale("LC_TIME", "English")library(ggplot2)library(anytime)library(tidyverse)library(svglite)library(Rcpp)polls <- read.table("DE.csv", header=T, sep=",", fileEncoding="UTF-8", stringsAsFactor=F)polls$polldate <- as.Date(anydate(polls$polldate))spansize <- 0.08           # general smoothing parameter for trend linennum <- 600                 # number of points used for trendline (resolution)startdate <- '2011-12-04'   # date of previous electionenddate <- '2016-09-18'     # (latest) date of next election# retrieve party names from CSVparty1 <- colnames(polls)[2]party2 <- colnames(polls)[3]party3 <- colnames(polls)[4]party4 <- colnames(polls)[5]party5 <- colnames(polls)[6]# define party colors (taken from https://www.how.com.vn/wiki/en/Category:Germany_political_party_colour_templates)col1 <- '#2E4EA4'col2 <- '#CC1111'col3 <- '#FFC003'col4 <- '#4488CC'transp <-'55'       # transparency level of pointsgraph <- ggplot(polls)+  geom_vline(xintercept = as.Date(startdate), color='#aaaaaabb')+       # vertical line (last election)  geom_vline(xintercept = as.Date(enddate), color='#aaaaaabb')+         # vertical line (next election)  geom_segment(aes(x=as.Date(startdate), xend=as.Date(enddate), y=5, yend=5), color='#666666bb', linetype='dashed')+      # horizontal line (election threshold 5%)  # add poll points  geom_point(aes_string(x='polldate',y=party1),size=ifelse(polls$polldate==startdate | polls$polldate==enddate,3,1.5),shape=ifelse(polls$polldate==startdate | polls$polldate==enddate,23,21),color=paste0(col1,transp),fill=paste0(col1,transp))+  geom_point(aes_string(x='polldate',y=party2),size=ifelse(polls$polldate==startdate | polls$polldate==enddate,3,1.5),shape=ifelse(polls$polldate==startdate | polls$polldate==enddate,23,21),color=paste0(col2,transp),fill=paste0(col2,transp))+  geom_point(aes_string(x='polldate',y=party3),size=ifelse(polls$polldate==startdate | polls$polldate==enddate,3,1.5),shape=ifelse(polls$polldate==startdate | polls$polldate==enddate,23,21),color=paste0(col3,transp),fill=paste0(col3,transp))+  geom_point(aes_string(x='polldate',y=party4),size=ifelse(polls$polldate==startdate | polls$polldate==enddate,3,1.5),shape=ifelse(polls$polldate==startdate | polls$polldate==enddate,23,21),color=paste0(col4,transp),fill=paste0(col4,transp))+  # add trend lines  # the "span" (smoothing parameter) should be manually changed for individual parties that have less polling data  geom_smooth(aes_string(x='polldate',y=party1,color=shQuote('col1')),method="loess",span=spansize,n=nnum,se=FALSE)+  geom_smooth(aes_string(x='polldate',y=party2,color=shQuote('col2')),method="loess",span=spansize,n=nnum,se=FALSE)+  geom_smooth(aes_string(x='polldate',y=party3,color=shQuote('col3')),method="loess",span=spansize,n=nnum,se=FALSE)+  geom_smooth(aes_string(x='polldate',y=party4,color=shQuote('col4')),method="loess",span=spansize,n=nnum,se=FALSE)+  scale_y_continuous(labels = function(x) paste0(x, "%"),limits=c(1,61))+    # add %, manual limits on y-axis  scale_x_date(limits = as.Date(c(startdate,enddate)), date_minor_breaks = "1 months", date_breaks = "3 months", date_labels = "%b %Y")+    # grid: 1 month, labels: 3 months  labs(x = "", y = "")+  scale_color_manual(name="",                     breaks = c('col1','col2','col3','col4'),                     labels = c(party1,party2,party3,party4),                     values = c('col1'=col1,'col2'=col2,'col3'=col3,'col4'=col4))+  # legend appearance  theme(    axis.text.x = element_text(size = 11),    axis.text.y = element_text(size = 12),    axis.title.y = element_text(size = 16),    legend.position="right",    legend.key.width=unit(24, "pt"),    legend.key.height=unit(24, "pt"),    legend.text = element_text(size=16, margin = margin(b = 5, t = 5, unit = "pt")))graph + theme()ggsave(file="polls.svg", plot=graph, width=18, height=8)# workaround since svglite doesn't properly work in Wikipediaaaa=readLines("polls.svg",-1)bbb <- gsub(".svglite ", "", aaa)writeLines(bbb,"polls.svg")
DE.csv
polldate,ER,KPRF,SR,LDPR2016-09-18,54.2,13.34,6.22,13.142016-09-11,41.1,7.4,6.3,12.62016-09-04,39.3,8.7,5.3,10.42016-08-28,41.2,7.7,5.4,12.22016-08-21,43.3,8.4,6.6,10.82016-08-14,44,10.1,7.5,11.82016-07-24,44.1,10.1,6.4,10.72016-07-17,44.9,8.7,6.7,11.32016-07-10,44,9.9,7.8,10.52016-07-03,44.3,10.4,7.9,92016-06-26,45.1,9.4,6.5,10.12016-06-19,43.1,9.5,6.9,11.42016-06-12,45.6,8.9,6.8,9.72016-06-05,46.7,10.3,5.1,10.12016-05-29,45.4,9.9,5.5,9.92016-05-22,46.2,9.3,5.9,112016-05-15,47.9,10.1,5.8,10.82016-05-01,49,10.7,6.4,10.52016-04-24,48.5,9.1,6.4,9.92016-04-17,47.6,10,5.6,9.22016-04-10,45.7,10.3,7.7,10.62016-04-03,47.9,9,6.3,8.52016-03-27,47.5,9.1,5.4,9.22016-03-20,44.1,10.1,6.3,9.62016-03-13,47.6,10.4,5.4,102016-03-06,44.9,11.5,6.2,8.12016-02-28,46.2,9.3,6.3,8.12016-02-21,48.4,8.5,5.9,9.32016-02-14,48.8,8.9,5.7,8.22016-02-07,51,7.5,5.8,8.92016-01-31,50.2,9.2,5.8,82016-01-24,59,8.8,6,92016-01-17,53.2,8.4,4.2,6.92015-12-27,52.8,8.1,5,7.32015-12-20,52.5,8.7,5.7,62015-12-13,50.8,9.1,5.3,5.62015-12-06,54,7.8,5.2,6.92015-11-29,52.2,7.9,5.8,6.92015-11-22,53.2,8.4,5.6,5.72015-11-15,52.5,8.5,4.7,7.62015-11-08,52,8.3,5.2,6.82015-11-01,52.7,7.7,5.2,6.52015-10-25,53.9,8.4,4.7,6.12015-10-18,54.1,7.4,4.9,5.22015-10-11,57.5,7.4,4.9,5.22015-10-04,54.7,7.4,5.5,6.12015-09-27,53.1,7.9,5.7,72015-09-20,54,8.7,5.4,62015-09-13,51.6,7.8,5.5,7.72015-09-06,53.5,7.5,5.1,6.92015-08-30,56.1,6.6,3.2,7.52015-08-23,53.6,8.4,4.4,6.82015-08-16,55.5,6.9,5.2,6.12015-07-26,56.4,6.6,3.3,5.62015-07-19,57.9,6.3,3.9,4.82015-07-12,58.8,6.4,3.9,5.12015-07-05,58.4,5.9,5.4,72015-06-28,57.6,6.6,3.1,5.32015-06-21,60.1,4.9,5.1,5.42015-06-14,57.9,6.8,4.6,4.82015-06-07,58.2,5.7,3.8,5.32015-05-31,56.6,5.8,5,5.82015-05-24,56.4,6.3,4,6.12015-05-17,60.6,4.8,4,5.82015-05-03,56.9,6.5,3.2,6.22015-04-26,55.1,6.8,4.4,6.12015-04-19,55.8,6,3.1,6.42015-04-12,58.1,5.8,3.8,62015-04-05,57.8,7.6,3.8,6.12015-03-29,57.4,6.7,3.9,6.12015-03-21,57.3,6.1,4.1,7.82015-03-15,56.9,7,3.3,6.82015-03-08,59.5,6.8,3.3,5.42015-03-01,58.6,6.4,3.8,5.42015-02-22,57.4,6.3,3.9,52015-02-15,59,5.9,3.5,5.32015-02-08,60.6,5.5,3.6,5.62015-02-01,59.6,5.8,3.3,3.82015-01-25,58.4,6.7,3.8,5.42015-01-18,60.3,6.4,2.5,4.82015-01-11,58.7,5.5,3.6,6.32014-12-21,57.1,5.2,3.8,5.62014-12-14,55.5,6.9,4.3,5.32014-12-07,56.8,7,4.9,5.42014-11-30,53.1,7.2,5.1,5.62014-11-23,57.6,7.3,4.8,5.12014-11-16,56.1,8.3,3.9,6.42014-11-09,57.6,7.2,4.6,62014-11-02,56.7,7.9,4.2,5.32014-10-26,57.6,7.5,4.3,6.12014-10-19,57.9,7.2,3.4,5.82014-10-12,59.5,7.6,4.3,52014-10-05,57.3,7.4,3,5.42014-09-28,57.5,6.8,2.9,5.92014-09-21,60.2,6.8,4.5,5.72014-09-14,58.7,6.8,2.6,6.52014-09-07,58.5,6.9,3.9,5.82014-08-31,56.1,6.7,4,62014-08-24,56.9,6.7,3.2,6.22014-08-17,58.5,7.2,3,5.42014-08-10,60.5,5.3,4,4.92014-07-27,54,7.3,3.9,5.82014-07-20,58,7.3,3.5,62014-07-13,56.3,7.7,3.6,6.82014-07-06,54.1,8.5,4.3,6.12014-06-29,52.8,8.4,3.8,6.82014-06-22,53.5,8.5,3.8,6.82014-06-15,55.8,7.1,4.3,6.62014-06-08,59.2,7.8,2.8,5.82014-06-01,58,7.7,3.3,6.42014-05-25,56,8,3,6.32014-05-18,60,8.4,2.6,5.72014-05-11,60.4,8.1,3.5,5.92014-04-27,55.7,7.3,3.6,62014-04-20,55.4,7.5,3.7,6.12014-04-13,53.7,8.3,4.6,6.92014-04-06,56.4,7.1,4,6.92014-03-30,53.4,8.1,5,6.62014-03-23,56.2,8,3.3,6.62014-03-16,50.1,9.1,2.9,62014-03-09,48.7,8.7,5,5.92014-03-02,47.6,9.5,3.6,7.42014-02-23,44.3,9.2,3.2,8.12014-02-16,41.3,10.8,3.2,7.92014-02-09,43.2,9.9,3.3,7.62014-02-02,43.9,10.1,3.9,8.32014-01-26,42.4,9.7,3.8,9.12014-01-19,42.8,10.8,4,9.22014-01-12,40,11.3,3.6,8.22013-12-22,42.7,10.3,4.9,82013-12-15,44.8,10.1,4.2,6.62013-12-08,42.5,10,4.2,82013-12-01,39.4,11.4,4.4,7.82013-11-24,42.7,10.6,4.2,8.92013-11-17,43.7,10.8,4.7,8.52013-11-10,41.9,9.6,4.4,8.332013-11-03,45.4,10.1,4,7.42013-10-27,40.1,10,5.2,10.42013-10-20,42.4,13.6,4.1,7.12013-10-13,43.8,10.4,3.5,8.12013-10-06,47.2,9.3,3.4,8.82013-09-29,43.2,11.1,4.7,9.82013-09-22,43.9,9.1,5,8.92013-09-15,44,11.2,4.8,8.92013-09-08,43.4,10.6,4,82013-09-01,40.6,11.2,5.8,102013-08-25,41.2,12.5,3.8,9.32013-08-18,44,11.3,5.5,6.72013-08-11,45.5,10.7,4.4,6.62013-07-28,44.9,12.2,4.5,7.32013-07-21,46.8,10.6,3.3,6.92013-07-14,43.3,10.1,3.9,7.22013-07-07,42.7,11,3.6,82013-06-30,44.2,8.8,3.3,9.22013-06-23,46.8,11.5,4.4,7.42013-06-16,45.9,10.3,3.7,82013-06-09,44.8,11.4,3.9,7.82013-06-02,44.2,10.5,4.8,8.52013-05-26,45,11,2.8,7.32013-05-19,46.6,10.6,4.8,6.42013-05-12,47,11.7,4.2,7.52013-04-28,43.8,11.6,4.5,8.32013-04-21,44.1,11.7,5.9,7.12013-04-14,44.3,11.6,4.9,82013-04-07,43.6,11.6,5.4,7.22013-03-31,44.3,11.9,4.3,9.42013-03-24,45.3,11.9,5.6,7.42013-03-17,44.5,11.3,4.5,8.32013-03-10,46.2,10.1,4.6,6.82013-03-03,44.2,10.3,3.9,6.52013-02-24,47.2,10.2,4.9,6.82013-02-17,47.6,8.9,4,6.52013-02-10,46.1,10.6,4.1,8.12013-02-03,46.4,10.9,4,6.32013-01-27,48.4,11.4,4.9,7.62013-01-20,46.1,10.6,4.2,6.32013-01-13,46.6,10.3,4.9,7.62012-12-23,49,9.9,5.5,6.52012-12-16,50.1,10.1,4,6.52012-12-09,48.4,11.1,3.9,7.52012-12-02,47.8,10,3.4,6.82012-11-25,45.2,10.6,5,6.42012-11-18,47.9,11.4,4.3,6.42012-11-11,49.7,8.9,4.9,6.12012-11-04,47.8,11.1,3.5,6.22012-10-28,45.6,10.8,4.7,6.42012-10-21,48.1,10.5,4.2,7.62012-10-14,47,10.7,4.3,6.82012-10-07,46.7,12.7,4.9,6.62012-09-30,43.8,10.4,5.4,5.92012-09-23,45.6,9.1,4.6,6.72012-09-16,46.5,11.5,5.3,8.72012-09-09,47.3,10.5,5.4,6.82012-09-02,45.5,10.8,5.6,7.12012-08-26,45.3,10.8,5.7,72012-08-19,44.8,9.2,6.5,82012-08-12,44.6,10.3,5.6,7.12012-07-22,44,9.4,6,7.52012-07-15,50.1,9.2,5.4,6.62012-07-08,45.1,11.2,6.3,6.52012-07-01,47.5,10.5,5.9,6.72012-06-24,48.7,10.7,4.2,6.32012-06-17,48.8,10.8,5.6,6.72012-06-10,50,10.9,5.3,5.62012-06-03,49.1,10.8,4.5,7.72012-05-27,50,11.2,5.4,7.42012-05-20,50.3,11.8,4.8,72012-05-13,50.6,11,5.7,6.12012-04-29,46.1,12.8,5.7,7.12012-04-22,49.9,10.6,4.9,7.12012-04-15,52.2,11.9,4.8,6.42012-04-08,51.7,12.3,4.4,5.62012-04-01,51.7,11.6,5.1,6.22012-03-25,48.3,12.6,6.4,7.62012-03-18,47.2,12.6,8.7,7.82012-03-11,49.4,14.6,5.3,7.32012-02-26,48.3,12.6,6.4,7.62012-02-19,45.5,12.6,6.8,10.12012-02-12,46,11.3,8.2,9.42012-02-05,44.2,12.8,5.5,9.32012-01-29,42.4,12.3,7,8.22012-01-22,42.1,12.6,9,102012-01-15,42,15,7,112012-01-08,39.7,13.8,8,9.92011-12-25,34.4,14.7,9.6,10.82011-12-18,36,16,8,112011-12-11,36,16,11,122011-12-04,49.32,19.19,13.24,11.672016-09-11,43,8,5,112016-09-04,41,9,4,112016-08-29,31,10,5,112016-08-28,44,8,5,92016-08-21,45,9,4,82016-08-14,42,10,8,92016-08-07,45,10,8,82016-07-31,47,9,8,82016-07-25,39,10,3,102016-07-24,44,10,7,112016-07-17,45,10,7,122016-07-10,46,10,6,122016-07-03,46,10,7,112016-06-27,55.8,18.2,5.1,14.22016-06-26,45,10,6,112016-06-24,39,6,4,52016-06-05,48,10,5,112016-04-10,46,9,5,112016-02-10,39,10,3,52015-12-10,44,10,2,52015-10-05,40,11,3,62015-09-07,43,11,3,52016-07-28,34,6,5,42015-11-23,44,10,5,22016-07-27,35,11,3,9
Date
SourceOwn work
AuthorPLATEL

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Элементы, изображённые на этом файле

depicts

У этого свойства есть некоторое значение без элемента в

18 December 2021

image/svg+xml

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current12:10, 22 June 2024Thumbnail for version as of 12:10, 22 June 20241,728 × 768 (243 KB)PLATELupd using new code (+small fix)
11:08, 18 December 2021Thumbnail for version as of 11:08, 18 December 20211,620 × 900 (237 KB)PLATELUploaded own work with UploadWizard
The following pages on the English Wikipedia use this file (pages on other projects are not listed):

Global file usage

The following other wikis use this file:

Metadata