2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-25 14:28:05 +02:00

Added Landtagswahlen-in-bayern diagramm

This commit is contained in:
Martin Thoma 2013-09-17 21:02:53 +02:00
parent 30e3ec3292
commit b77ed3cf0b
4 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,35 @@
SOURCE = landtagswahlen-in-bayern
DELAY = 80
DENSITY = 300
WIDTH = 512
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
make
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
rm $(SOURCE)2.svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](landtagswahlen-in-bayern.png)

View file

@ -0,0 +1,18 @@
Wahltag,Wahlbeteiligung,CSU,SPD,FDP,GRÜNE,BP,FW,ÖDP,REP,NPD,KPD,GB/BHE,Sonstige
1946-06-30,72.1,58.3,28.8,2.5,,,,,,,5,3,,WAV 5,1
1946-12-01,75.7,52.3,28.6,5.7,,,,,,,6,1,,WAV 7,4
1950-11-26,79.9,27.4,28.0,7.1,,17,9,,,,,1,9,BHE/DG12,3,WAV 2,8
1954-11-28,82.4,38.0,28.1,7.2,,13,2,,,,,2,1,10,2,
1958-11-23,76.6,45.6,30.8,5.6,,8,1,,,,,,8,6,
1962-11-25,76.5,47.5,35.3,5.9,,4,8,,,,,,GDP 5,1,
1966-11-20,80.6,48.1,35.8,5.1,,3,4,,,,7,4,,,
1970-11-22,79.5,56.4,33.3,5.6,,1,3,,,,2,9,,,
1974-10-27,77.7,62.1,30.2,5.2,,0,8,,,,1,1,,,
1978-10-15,76.6,59.1,31.4,6.2,1.8,0,4,,,,0,6,,,
1982-10-10,78.0,58.3,31.9,3.5,4.6,0,5,,0,4,,0,6,,,
1986-10-12,70.1,55.8,27.5,3.8,7.5,0,6,,0,7,3,0,0,5,,,
1990-10-14,65.9,54.9,26.0,5.2,6.4,0,8,,1,7,4,9,,,,
1994-09-25,67.8,52.8,30.0,2.8,6.1,1,0,0,1,2,1,3,9,0,1,,,
1998-09-13,69.8,52.9,28.7,1.7,5.7,0,7,3,7,1,8,3,6,0,2,,,
2003-10-21,57.1,60.7,19.6,2.6,7.7,0,7,4,0,2,0,2,2,,,,
2008-10-28,58.1,43.4,18.6,8.0,9.4,1,1,10,2,2,0,1,4,1,2,,,Linke 4,4
1 Wahltag,Wahlbeteiligung,CSU,SPD,FDP,GRÜNE,BP,FW,ÖDP,REP,NPD,KPD,GB/BHE,Sonstige
2 1946-06-30,72.1,58.3,28.8,2.5,,,,,,,5,3,,WAV 5,1
3 1946-12-01,75.7,52.3,28.6,5.7,,,,,,,6,1,,WAV 7,4
4 1950-11-26,79.9,27.4,28.0,7.1,,17,9,,,,,1,9,BHE/DG12,3,WAV 2,8
5 1954-11-28,82.4,38.0,28.1,7.2,,13,2,,,,,2,1,10,2,
6 1958-11-23,76.6,45.6,30.8,5.6,,8,1,,,,,,8,6,
7 1962-11-25,76.5,47.5,35.3,5.9,,4,8,,,,,,GDP 5,1,
8 1966-11-20,80.6,48.1,35.8,5.1,,3,4,,,,7,4,,,
9 1970-11-22,79.5,56.4,33.3,5.6,,1,3,,,,2,9,,,
10 1974-10-27,77.7,62.1,30.2,5.2,,0,8,,,,1,1,,,
11 1978-10-15,76.6,59.1,31.4,6.2,1.8,0,4,,,,0,6,,,
12 1982-10-10,78.0,58.3,31.9,3.5,4.6,0,5,,0,4,,0,6,,,
13 1986-10-12,70.1,55.8,27.5,3.8,7.5,0,6,,0,7,3,0,0,5,,,
14 1990-10-14,65.9,54.9,26.0,5.2,6.4,0,8,,1,7,4,9,,,,
15 1994-09-25,67.8,52.8,30.0,2.8,6.1,1,0,0,1,2,1,3,9,0,1,,,
16 1998-09-13,69.8,52.9,28.7,1.7,5.7,0,7,3,7,1,8,3,6,0,2,,,
17 2003-10-21,57.1,60.7,19.6,2.6,7.7,0,7,4,0,2,0,2,2,,,,
18 2008-10-28,58.1,43.4,18.6,8.0,9.4,1,1,10,2,2,0,1,4,1,2,,,Linke 4,4

View file

@ -0,0 +1,41 @@
\documentclass[varwidth=false, border=2pt]{standalone}
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage[margin=2.5cm]{geometry} %layout
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}
\usetikzlibrary{pgfplots.dateplot}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
date coordinates in=x,
xticklabel={\year},
x tick label style={align=center, rotate=45},
date ZERO=2010-01-01, % Set near lowest date
xmin={1945-01-01}, % A date with no time is assumed to have a time of 00:00
xmax={2010-01-01},
extra y ticks={5},
/pgfplots/ytick={0,10,...,100},
%axis x line=middle,
%axis y line=middle,
%enlarge y limits=true,
ymin=0, ymax=100,
width=15cm, height=8cm, % size of the image
grid = major,
grid style={dashed, gray!30},
ylabel=\%,
%xlabel=Jahr,
legend style={at={(1.2,1)}, anchor=north}
]
\addplot[blue, dashed, mark=triangle*] table [x=Wahltag, y=Wahlbeteiligung, col sep=comma] {landtagswahlen-in-bayern.csv};
\addplot[black,mark=square*] table [x=Wahltag, y=CSU, col sep=comma] {landtagswahlen-in-bayern.csv};
\addplot[red,mark=square*] table [x=Wahltag, y=SPD, col sep=comma] {landtagswahlen-in-bayern.csv};
\addplot[green,mark=square*] table [x=Wahltag, y=GRÜNE, col sep=comma] {landtagswahlen-in-bayern.csv};
\addplot[yellow,mark=square*] table [x=Wahltag, y=FDP, col sep=comma] {landtagswahlen-in-bayern.csv};
\legend{Wahlbeteiligung,CSU,SPD,Grüne,FDP}
\end{axis}
\end{tikzpicture}
\end{document}