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

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file(SVG file, nominally 1,620 × 900 pixels, file size: 282 KB)

Summary

Description
English: Opinion polling for the 2026 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)

polls <- read.table("CAT.csv", header=T, sep=",", fileEncoding="UTF-8", stringsAsFactor=F)
polls$polldate <- as.Date(anydate(polls$polldate))

spansize <- 0.8           # general smoothing parameter for trend line
startdate <- '2021-09-19'   # date of previous election
enddate <- '2026-09-20'     # (latest) date of next election

# retrieve party names from CSV
party1 <- 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://en.wikipedia.org/wiki/Category:Germany_political_party_colour_templates)
col1 <- '#2E4EA4'
col2 <- '#CC1111'
col3 <- '#4488CC'
col4 <- '#FFC003'
col5 <- '#0AD1C9'

transp <-'55'       # transparency level of points

graph <- 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))+
  geom_point(aes_string(x='polldate',y=party5),size=ifelse(polls$polldate==startdate | polls$polldate==enddate,3,1.5),shape=ifelse(polls$polldate==startdate | polls$polldate==enddate,23,21),color=paste0(col5,transp),fill=paste0(col5,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')),span=spansize,se=FALSE)+
  geom_smooth(aes_string(x='polldate',y=party2,color=shQuote('col2')),span=spansize,se=FALSE)+
  geom_smooth(aes_string(x='polldate',y=party3,color=shQuote('col3')),span=spansize,se=FALSE)+
  geom_smooth(aes_string(x='polldate',y=party4,color=shQuote('col4')),span=spansize,se=FALSE)+
  geom_smooth(aes_string(x='polldate',y=party5,color=shQuote('col5')),span=spansize,se=FALSE)+
  scale_y_continuous(labels = function(x) paste0(x, "%"),limits=c(1,50))+    # 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','col5'),
                     labels = c(party1,party2,party3,party4,party5),
                     values = c('col1'=col1,'col2'=col2,'col3'=col3,'col4'=col4,'col5'=col5))+
  # 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=10)

# workaround since svglite doesn't properly work in Wikipedia
aaa=readLines("polls.svg",-1)
bbb <- gsub(".svglite ", "", aaa)
writeLines(bbb,"polls.svg")
CAT.csv
polldate,ER,KPRF,LDPR,SRZP,NL
2021-12-05,32,16,9,5,6
2021-12-05,28.3,18.2,7.7,6.9,8.6
2021-12-01,26,13,8,4,5
2021-11-28,31,15,9,5,6
2021-11-28,28.6,18,7.8,6.9,8.1
2021-11-21,30,15,8,5,6
2021-11-21,29.2,18.6,7.6,6.9,8.2
2021-11-14,30,15,9,5,6
2021-11-14,28.9,18.7,7.9,6.5,8.1
2021-11-07,31,15,10,6,7
2021-11-07,30.2,17.7,7.4,6.6,7.8
2021-10-31,31,16,9,6,6
2021-10-31,28.6,19.4,8.1,7.1,8.7
2021-10-27,29,14,8,5,5
2021-10-24,29,17,8,6,6
2021-10-24,29.8,19.4,7.3,6.9,8.5
2021-10-17,30,18,9,6,6
2021-10-17,30.1,19.8,7.7,6,8.6
2021-10-10,29.8,20.2,7.5,6.3,8.6
2021-10-03,29.8,20.2,7.3,6.1,8.4
2021-09-26,29.5,23.3,7.6,6.4,8.4
2021-09-19,49.82,18.93,7.55,7.46,5.32
Date
Source Own work
Author PLATEL

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

Items portrayed in this file

depicts

15 December 2021

image/svg+xml

File history

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

(newest | oldest) View (newer 10 | ) (10 | 20 | 50 | 100 | 250 | 500)
Date/TimeThumbnailDimensionsUserComment
current14:46, 7 April 2024Thumbnail for version as of 14:46, 7 April 20241,620 × 900 (282 KB)PLATELupd
10:24, 11 March 2024Thumbnail for version as of 10:24, 11 March 20241,620 × 900 (273 KB)PLATELupd
00:07, 30 January 2024Thumbnail for version as of 00:07, 30 January 20241,620 × 900 (263 KB)PLATELupd
14:51, 9 December 2023Thumbnail for version as of 14:51, 9 December 20231,620 × 900 (251 KB)PLATELupd
01:23, 25 October 2023Thumbnail for version as of 01:23, 25 October 20231,620 × 900 (239 KB)PLATELupd
21:57, 27 August 2023Thumbnail for version as of 21:57, 27 August 20231,620 × 900 (223 KB)PLATELupd
19:45, 1 July 2023Thumbnail for version as of 19:45, 1 July 20231,620 × 900 (208 KB)PLATELupd
23:03, 23 May 2023Thumbnail for version as of 23:03, 23 May 20231,620 × 900 (196 KB)PLATELupd
22:09, 26 April 2023Thumbnail for version as of 22:09, 26 April 20231,620 × 900 (189 KB)PLATELupd
14:49, 17 March 2023Thumbnail for version as of 14:49, 17 March 20231,620 × 900 (179 KB)PLATELupd
(newest | oldest) View (newer 10 | ) (10 | 20 | 50 | 100 | 250 | 500)
The following pages on the English Wikipedia use this file (pages on other projects are not listed):

Metadata