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.
The file can be produced as follows from the source file with sha512sum 97d4bbb830c105d0fc292d1828e0dc9a6ed52243c65e91bf5cd6fbb584d2a67446e8f4d2f70bde8eb529fb7d40318bd4cc1935567c31a19acc942f8a4cd47551.
#!/bin/bash
# extract_dem_v_core.sh Copyright (C) 2025 CC-BY SA 4.0 Boud Roukema
# See https://creativecommons.org/licenses/by-sa/4.0 for details.
# apt-get install plotutils # to install 'graph'
# Data source:
# https://web.archive.org/web/20250612224128/https://www.v-dem.net/media/datasets/V-Dem-CY-Core-v15_csv.zip
# sha512sum: 97d4bbb830c105d0fc292d1828e0dc9a6ed52243c65e91bf5cd6fbb584d2a67446e8f4d2f70bde8eb529fb7d40318bd4cc1935567c31a19acc942f8a4cd47551
DEMV_VERSION=15
FILE=V-Dem-CY-Core-v${DEMV_VERSION}.csv
#COUNTRY="FRA"
#COUNTRY="HUN"
#COUNTRY="POL"
COUNTRY="RUS"
#COUNTRY="USA" # check against https://commons.wikimedia.org/wiki/File:V-Dem_Electoral_and_Liberal_Democracy_Indices_for_the_United_States,_1900%E2%80%932024.svg
FONT="HersheySerif"
FSIZE=0.04
MARGINS="-r 0.15 -w 0.8 -u 0.1 -h 0.85"
XLAB=year
YLAB="DemV index (solid: elec dem; dotted: lib dem)"
FSIZE=0.04
# head -n 1 V-Dem-CY-Core-v15.csv |sed -e 's/\",\"/\"\n\"/g' | nl -ba |less
# 1 "country_name"
# 2 "country_text_id"
# 3 "country_id"
# 4 "year"
# 23 "v2x_polyarchy"
# 27 "v2x_libdem"
# 31 "v2x_partipdem"
# 35 "v2x_delibdem"
# 39 "v2x_egaldem"
if ! [ -e tmp.${COUNTRY} ]; then
tail -n +2 ${FILE} | sed -e 's/\",\"/\";\"/g' \
-e 's/\",\([0-9]\)/\";\1/g' \
-e 's/\([0-9]\),/\1;/g' \
-e 's/,,/;;/g' \
-e 's/,,,/;;;/g' \
-e 's/;,/;;/g' |
awk -F ";" -v c=\"${COUNTRY}\" '{if($2==c)print $2,$4,$23,$27}' > tmp.${COUNTRY}
fi
# Individual hacks for missing data per country: look at tmp.${COUNTRY}
# and list the years for which ratings are missing.
case "${COUNTRY}" in
POL)
grep -vE " (1807|1808|1867)" tmp.${COUNTRY} > tmp.${COUNTRY}.has_data
;;
*)
cp -pv tmp.${COUNTRY} tmp.${COUNTRY}.has_data
;;
esac
(awk '{print $2,$3}' tmp.${COUNTRY}.has_data; printf "\n"; \
awk '{print $2,$4}' tmp.${COUNTRY}.has_data) | \
graph -Tsvg -X "${XLAB}" -Y "${YLAB}" -F ${FONT} -f ${FSIZE} > \
DemV_2024_${COUNTRY}.svg
Captions
V-Dem Democracy Indices for electoral democracy (solid) and liberal democracy (dotted) for Russia (through to 2025 inclusive; v16)