File:Wybory do sejmików - głosy nieważne w województwach 2002-2014.svg

Original file(SVG file, nominally 720 × 810 pixels, file size: 2.13 MB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary edit

Description
English: Maps showing percentage of votes cast in elections to sejmiks which were invalid in years 2002, 2006, 2010, 2014 in each voivodeship. Data from [1] [2] [3] [4]
Polski: Mapy pokazujące ilość głosów nieważnych jako procent wszystkich oddanych głosów w wyborach do sejmików w latach 2002, 2006, 2010, 2014 w podziale na województwa. Dane z [5] [6] [7] [8]
Date
Source Own work
Author Attomir
SVG development
InfoField
 
The SVG code is valid.
 
This map was created with R.
Source code
InfoField

R code

Sys.setlocale("LC_ALL", 'en_US.UTF-8')

library(maptools)
library(ggplot2)
library(gpclib)
library(rgeos)

# shapefile from http://www.codgik.gov.pl/index.php/darmowe-dane/prg.html
# "PRG - jednostki administracyjne"
# copy all "województwa.*" files, then change "ó" to "o"
woj_shp <- readShapePoly("./wojewodztwa.shp")

# reduce the number of vertices in polygons
woj_shp_s <- gSimplify(woj_shp, tol=2000, topologyPreserve=TRUE)

woj_poly <- fortify(woj_shp_s)
woj_wsp <- sapply(woj_shp@polygons, function(x) x@labpt)

# "śląskie" polygon has errors, this can be fixed by trimming some points
# from the end of the vector
woj_ds = subset(woj_poly, id == '5')
woj_ds_cutoff = length(woj_ds$id)*.99
woj_poly = rbind(subset(woj_poly, id != '5'), woj_ds[1:woj_ds_cutoff,])


abbr_teryt <- list(ds="02", kp="04", lu="06", lb="08", ld="10", mp="12", ma="14", op="16", 
              pk="18", pd="20", pm="22", sl="24", sk="26", wn="28", wp="30", zp="32")
teryt_abbr <- list()
for (k in names(abbr_teryt)) {
    v <- abbr_teryt[[k]]
    teryt_abbr[v] <- k
}

years = data.frame(year = c(2002, 2006, 2010, 2014))

woj_labels <- data.frame(
    name=woj_shp@data$jpt_nazwa_,
    teryt=woj_shp@data$jpt_kod_je, 
    long = woj_wsp[1,], 
    lat = woj_wsp[2,])
woj_labels$abbr = sapply(woj_labels$teryt, function(x) teryt_abbr[[x]])

woj_elections <- merge(woj_labels, years, by=NULL)
woj_invalid <- read.csv("woj_invalid.csv", comment.char="#")

woj_elections$invalid <- mapply(
    function(y, n) woj_invalid$invalid[(woj_invalid$year == y) & (woj_invalid$woj == n)], 
        woj_elections$year, 
        woj_elections$abbr)

woj_teryt <- woj_shp@data$jpt_kod_je

woj_poly$abbr <- sapply(as.numeric(woj_poly$id), function(x) teryt_abbr[[woj_teryt[[x+1]]]])

woj_poly_elections <- merge(woj_poly, years, by=NULL)
woj_poly_elections$invalid <- mapply(
    function(y, n) woj_invalid$invalid[(woj_invalid$year == y) & (woj_invalid$woj == n)], 
    woj_poly_elections$year, 
    woj_poly_elections$abbr)


sum_labels <- data.frame(lat=200000, long=300000, year=c(2002, 2006, 2010, 2014), label=c(14.43, 12.70, 12.06, 17.47))    

ggplot() +
  facet_wrap(~year) + 
  geom_polygon(data=woj_poly_elections, aes(x=long, y=lat, group=id, fill=invalid*100), colour="black", size=0.25) +
  geom_text(data=woj_elections, aes(x=long, y=lat, label=format(invalid*100, digits=2)), colour="white", fontface=2) +
  geom_text(data=sum_labels, aes(x=long, y=lat, label=paste("ogółem: ", label)), colour="black", fontface=2) +
  theme(axis.ticks = element_blank(),
        axis.text.x = element_blank(),
        axis.text.y = element_blank(),
        panel.grid.minor=element_blank(),
        panel.grid.major=element_blank(),
        axis.title.x = element_blank(),
        axis.title.y = element_blank(),
        panel.border = element_blank(),
        text = element_text(size=18),
        legend.position = "bottom") + 
  scale_fill_gradient2('głosy nieważne [%]', low = "yellow", mid="red", high="black", midpoint=15, limits=c(5,25)) +
#  ggtitle('Głosy nieważne w wyborach do sejmików województw')

ggsave(filename='sam_niew.svg', width=8, height=9)

l2=text

Data

# data from:
# http://wybory2002.pkw.gov.pl/sejmik/gw1/index.html
# http://wybory2006.pkw.gov.pl/kbw/geoKraj.html?
# http://wybory2010.pkw.gov.pl/geo/pl/000000.html
# http://pkw.gov.pl/g2/oryginal/2015_03/e98502c393fb74140ee137cd863dc15c.xls
year,woj,invalid
2002,ds,0.1902
2006,ds,0.1249
2010,ds,0.1092
2014,ds,0.1811
2002,kp,0.1680
2006,kp,0.1364
2010,kp,0.1308
2014,kp,0.1868
2002,lb,0.1652
2006,lb,0.1330
2010,lb,0.1261
2014,lb,0.1960
2002,ld,0.1250
2006,ld,0.1356
2010,ld,0.1201
2014,ld,0.1716
2002,lu,0.1275
2006,lu,0.1172
2010,lu,0.1120
2014,lu,0.1658
2002,ma,0.1700
2006,ma,0.1460
2010,ma,0.1403
2014,ma,0.1554
2002,mp,0.1240
2006,mp,0.1148
2010,mp,0.1145
2014,mp,0.1669
2002,op,0.1230
2006,op,0.1200
2010,op,0.1104
2014,op,0.1825
2002,pd,0.1116
2006,pd,0.1030
2010,pd,0.0935
2014,pd,0.1496
2002,pk,0.1249
2006,pk,0.1234
2010,pk,0.1121
2014,pk,0.1601
2002,pm,0.1086
2006,pm,0.0967
2010,pm,0.1043
2014,pm,0.1785
2002,sk,0.1291
2006,sk,0.1297
2010,sk,0.1156
2014,sk,0.1672
2002,sl,0.1147
2006,sl,0.0987
2010,sl,0.0986
2014,sl,0.1520
2002,wn,0.1430
2006,wn,0.1352
2010,wn,0.1301
2014,wn,0.2036
2002,wp,0.1783
2006,wp,0.1664
2010,wp,0.1527
2014,wp,0.2298
2002,zp,0.1671
2006,zp,0.1221
2010,zp,0.1292
2014,zp,0.1946

Licensing edit

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

File history

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

Date/TimeThumbnailDimensionsUserComment
current20:05, 25 July 2015Thumbnail for version as of 20:05, 25 July 2015720 × 810 (2.13 MB)Attomir (talk | contribs)Moved legend to the bottom
19:37, 25 July 2015Thumbnail for version as of 19:37, 25 July 2015900 × 675 (2.12 MB)Attomir (talk | contribs)User created page with UploadWizard

The following page uses this file:

File usage on other wikis

The following other wikis use this file:

Metadata