\documentclass[tikz]{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepgfplotslibrary{polar} \usetikzlibrary{shapes.geometric} \usepackage{fontspec} \setmainfont{Atkinson Hyperlegible} \begin{document} \def\circleradius{7.5} \def\minute{2.6277} \pgfmathparse{\minute/2} \let\halfminute\pgfmathresult \pgfplotstableread[col sep=comma]{times.csv}\data \definecolor{one}{RGB}{243,155,154} \definecolor{two}{RGB}{176,0,68} \definecolor{three}{RGB}{213,173,0} \definecolor{four}{RGB}{227,0,11} \definecolor{five}{RGB}{0,150,94} \definecolor{six}{RGB}{149,107,37} \definecolor{seven}{RGB}{255,204,0} \definecolor{fifteen}{RGB}{247,171,99} \definecolor{sixteen}{RGB}{94,107,175} \definecolor{twentyone}{RGB}{227,0,11} \definecolor{twentytwo}{RGB}{253,195,0} \definecolor{twentythree}{RGB}{228,142,0} \definecolor{twentyfour}{RGB}{140,29,117} \definecolor{twentysix}{RGB}{243,155,154} \def\arcbetween#1#2#3#4{% \pgfplotstablegetelem{#1}{Time Angle}\of\data \pgfmathparse{\pgfplotsretval-30.975} \let\angleone\pgfmathresult \pgfplotstablegetelem{#2}{Time Angle}\of\data \pgfmathparse{\pgfplotsretval-30.975} \let\angletwo\pgfmathresult \pgfmathparse{\circleradius+0.1*#3} \let\radius\pgfmathresult \draw[ultra thick, color=#4] (\angleone:\radius) arc [start angle=\angleone, end angle=\angletwo, x radius=\radius, y radius=\radius]; } \def\stop#1#2#3{% \pgfplotstablegetelem{#1}{Stop}\of\data \let\name\pgfplotsretval \pgfplotstablegetelem{#1}{Time Angle}\of\data \pgfmathparse{\pgfplotsretval-30.975} \let\angle\pgfmathresult \pgfmathparse{#2*0.1} \let\width\pgfmathresult \pgfmathparse{\circleradius+(#3*0.1)} \let\radius\pgfmathresult \node[anchor=east, rotate=\angle] at (\angle:\circleradius-0.5+0.05) {\footnotesize\name}; % \draw[thick, fill=white] (\angle:5cm) circle [radius=0.5ex] {}; \draw[rounded corners=0.05cm, thick, fill=white, rotate=\angle, shift={(-0.05, -0.05)}] (0:\radius) rectangle ++(\width,0.1cm); } \def\legend#1{% % Circle for the legend \draw circle [radius=0.15cm]; \draw[draw, color=black] circle [radius=\circleradius+2]; \draw[thick] circle [radius=#1]; \pgfmathparse{#1+0.2} \let\rmajor\pgfmathresult \pgfmathparse{#1+0.1} \let\rminor\pgfmathresult % Major ticks clockwise \draw[thick] (90:#1) -- (90:\rmajor); \foreach \i in {5,10,...,65} { \pgfmathparse{90-\i * 2.6277} \let\angle\pgfmathresult \draw[thick] (\angle:#1) -- (\angle:\rmajor); \node[anchor=west, rotate=\angle] at (\angle:\rmajor) {\scriptsize \i~min}; } % Minor ticks clockwise \foreach \i in {1,2,...,65} { \pgfmathparse{90-\i * 2.6277} \let\angle\pgfmathresult \draw[thick] (\angle:#1) -- (\angle:\rminor); } % Major ticks anti-clockwise \foreach \i in {5,10,...,65} { \pgfmathparse{90+\i * 2.6277} \let\angle\pgfmathresult \draw[thick] (\angle:#1) -- (\angle:\rmajor); \node[anchor=east, rotate=\angle-180] at (\angle:\rmajor) {\scriptsize \i~min}; } % Minor ticks anti-clockwise \foreach \i in {1,2,...,65} { \pgfmathparse{90+\i * 2.6277} \let\angle\pgfmathresult \draw[thick] (\angle:#1) -- (\angle:\rminor); } % Extra marks \draw[thick] (-90:#1) -- (-90:\rmajor); \node [isosceles triangle, anchor=east, fill=red, rotate=-90] (tringle) at (90:#1){}; \node[anchor=south, rotate=0, color=red] at (tringle.west) {\footnotesize 0~min}; } \def\bendin#1#2#3#4#5{% % First angle \pgfplotstablegetelem{#1}{Time Angle}\of\data \pgfmathparse{\pgfplotsretval-30.975} \let\angletwo\pgfmathresult % Second angle \pgfmathparse{\pgfplotsretval-30.975+#2*\halfminute} \let\anglethree\pgfmathresult \pgfmathparse{\circleradius+#3*0.1} \let\radius\pgfmathresult \draw[ultra thick, color=#5, rounded corners=#4*.5ex] (\angletwo:\radius) -- (\anglethree:\radius) -- (\anglethree:\circleradius-0.5) ; } \def\bendout#1#2#3#4#5{% % First angle \pgfplotstablegetelem{#1}{Time Angle}\of\data \pgfmathparse{\pgfplotsretval-30.975} \let\angletwo\pgfmathresult % Second angle \pgfmathparse{\pgfplotsretval-30.975+#2*\halfminute} \let\anglethree\pgfmathresult \pgfmathparse{\circleradius+#3*0.1} \let\radius\pgfmathresult % \draw[ultra thick, color=#5, rounded corners=#4*.5ex] (\angletwo:\radius) -- (\anglethree:\radius) -- (\anglethree:\circleradius+0.5) ; } \def\crossing#1#2#3#4{% \pgfplotstablegetelem{#1}{Time Angle}\of\data \pgfmathparse{\pgfplotsretval-30.975} \let\angleone\pgfmathresult \pgfplotstablegetelem{#2}{Time Angle}\of\data \pgfmathparse{\pgfplotsretval-30.975} \let\angletwo\pgfmathresult \pgfmathparse{(\angleone+\angletwo)/2+#3} \let\angle\pgfmathresult \draw[ultra thick, color=#4] (\angle:\circleradius-0.5) -- (\angle:\circleradius+0.5); } \def\citybetween#1#2#3{% \pgfplotstablegetelem{#1}{Time Angle}\of\data \pgfmathparse{\pgfplotsretval-30.975+\halfminute} \let\angleone\pgfmathresult \pgfplotstablegetelem{#2}{Time Angle}\of\data \pgfmathparse{\pgfplotsretval-30.975-\halfminute} \let\angletwo\pgfmathresult \pgfmathparse{2} \let\radius\pgfmathresult \draw[very thick, color=#3] (\angleone:\radius) arc [start angle=\angleone, end angle=\angletwo, x radius=\radius, y radius=\radius]; } \begin{tikzpicture} % Circle for the line \draw[ultra thick, color=five] circle [radius=\circleradius]; \crossing{18}{19}{-0.6*\halfminute}{five} \crossing{18}{19}{0}{two} \crossing{18}{19}{0.6*\halfminute}{seven} \crossing{28}{29}{0}{five} % Other lines % Mannheim \bendout{15}{-1}{1}{1}{six} \bendout{20}{1}{1}{1}{seven} \arcbetween{20}{24}{1}{seven} % 7 (again) \arcbetween{20}{25}{-1}{fifteen} % 15 (again) \bendin{20}{2.8}{-1}{4}{fifteen} \arcbetween{20}{25}{-2}{one} % 1 \bendin{20}{2.2}{-2}{3}{one} \arcbetween{20}{22}{-3}{four} \bendin{20}{1.6}{-3}{2}{four} \arcbetween{20}{22}{-4}{three} \bendin{20}{1}{-4}{1}{three} % Paradeplatz \arcbetween{22}{25}{2}{six} % 6 \arcbetween{24}{26}{-3}{four} % 4 \bendout{22}{-1.0}{-3}{2}{four} \bendout{22}{-1.3}{-4}{2}{three} \bendout{22}{-0.7}{3}{1}{two} \bendin{22}{1.6}{3}{2}{two} \bendin{22}{1}{2}{1}{six} \bendin{24}{-1}{1}{1}{seven} \bendin{24}{1}{-3}{1}{four} % Main station \bendin{25}{-1.4}{-2}{1}{one} \arcbetween{25}{26}{1}{three} \bendin{25}{-2}{2}{2}{six} \bendin{26}{2}{2}{2}{six} \bendout{26}{-0.5}{2}{1}{six} \bendout{26}{-0.8}{1}{1}{three} \bendout{26}{-1.1}{-3}{1}{four} \arcbetween{27}{30}{-1}{two} \bendout{27}{0.6}{-1}{1}{two} \arcbetween{28}{30}{-2}{seven} \bendout{28}{1}{-2}{1}{seven} % Universitätsklinikum \bendin{30}{-1}{-2}{1}{seven} \bendin{30}{-1.6}{-1}{2}{two} \bendout{30}{1.6}{1}{2}{fifteen} \bendout{30}{1}{2}{1}{four} \arcbetween{30}{36}{1}{fifteen} \arcbetween{30}{32}{2}{four} \bendout{32}{-1}{2}{1}{four} \bendin{36}{-1.4}{1}{2}{fifteen} \bendin{36}{-0.8}{0}{1}{five} \bendout{37}{-1}{1}{1}{sixteen} % Heidelberg % Hans-Thoma Pl. \arcbetween{63}{64}{-1}{twentyfour} % 24 \bendin{64}{-1}{-2}{1}{twentyone} % 21 \bendin{64}{-1.6}{-1}{2}{twentyfour} % 24 \arcbetween{63}{69}{1}{twentysix} % 26 % Bismarckplatz \arcbetween{70}{73}{1}{twentyone} % 21 \bendin{69}{-1.7}{1}{1}{twentysix} % 26 towards kirchheim \bendin{70}{1.7}{1}{1}{twentyone} % 21 towards hans-thoma (north) \bendin{73}{-0.8}{1}{1}{twentyone} % 21 towards hans-thoma (south) \arcbetween{69}{71}{2}{twentythree} % 23 \arcbetween{69}{71}{3}{twentytwo} % 22 % Stadtbücherei \bendout{71}{-0.7}{3}{1}{twentytwo} % 22 towards eppelheim \bendout{71}{-1}{2}{1}{twentythree} % 23 towards leimen \bendout{72}{0.7}{2}{1}{twentyfour} \arcbetween{72}{73}{2}{twentyfour} % 24 (again) \bendin{73}{-1.4}{2}{2}{twentyfour} % \arcbetween{64}{64}{1}{red} % 21 (again) % Stops \foreach \i in {1,...,14} { \stop{\i}{1}{0} } \stop{15}{2}{0} \foreach \i in {16,...,19} { \stop{\i}{1}{0} } \foreach \i in {20,...,21} { \stop{\i}{6}{-4} } \stop{22}{8}{-4} \stop{23}{5}{-2} \stop{24}{6}{-3} \stop{25}{6}{-3} % \foreach \i in {24,...,25} { \stop{\i}{4}{-1} } % \stop{25}{4}{-2} \stop{26}{6}{-3} \stop{27}{2}{-1} \stop{28}{3}{-2} \stop{29}{3}{-2} \stop{30}{5}{-2} \foreach \i in {31,...,32} { \stop{\i}{3}{0} } \foreach \i in {33,...,35} { \stop{\i}{2}{0} } \stop{36}{2}{0} \stop{37}{2}{0} \foreach \i in {38,...,62} { \stop{\i}{1}{0} } \stop{63}{3}{-1} \stop{64}{4}{-2} \foreach \i in {65,...,68} { \stop{\i}{2}{0} } \stop{69}{4}{0} \stop{70}{4}{0} \stop{71}{4}{0} \stop{72}{3}{0} \stop{73}{3}{0} % \draw[very thick, color=black] (-338.4202:2cm) arc [start angle=-338.4202, delta angle=-42.6014-30, x radius=2cm, y radius=2cm]; % \citybetween{63}{9}{black}{} % \citybetween{16}{38}{black}{} % \citybetween{39}{43}{black}{} % \citybetween{44}{50}{black}{} % \citybetween{57}{59}{black}{} % \citybetween{60}{62}{black}{} \pgfmathparse{\circleradius-0.5} \draw[color=black] circle [radius=\pgfmathresult]; \pgfmathparse{\circleradius+0.5} \draw[color=black] circle [radius=\pgfmathresult]; \legend{\circleradius+0.6} \end{tikzpicture} \begin{tikzpicture} \legend{\circleradius+0.6} \end{tikzpicture} % \begin{tikzpicture} % \begin{polaraxis}[ % xtick=data, % ytick=\empty, % xticklabels from table={\data}{Stop}, % xticklabel style={ % sloped like x axis={ % allow upside down=true, % % execute for upside down=\tikzset{right}, % % reset nontranslations=false, % }, % left, % font=\scriptsize, % rotate=60, % }, % xmin=-360, % xmax=0, % rotate=-30, % ] % \addplot[draw=none, mark=none] table [x=Time Angle, y=Index] {\data}; % \end{polaraxis} % \end{tikzpicture} \end{document} % vim: conceallevel=0 nospell