mein Problem ist das folgende: Ich möchte eine Grafik erstellen, jedoch fängt eine Spalte des Datensatzes später an (Spalte 4). Dieses müsste mit "skip coords between index={0}{3}" zu lösen sein, allerdings fängt der Plot nicht zu dem gewünschten Zeitpunkt an, sondern ab dem Anfang. Somit ist die rote Linie nicht mehr synchron mit den anderen beiden und die Werte nicht vergleichbar. Wie bekomme ich es hin, dass die ersten (leeren) Werte der roten Linie wirklich übersprungen wird und die Punkte an die richtige Stelle kommen? Ich danke vielmals im Voraus! anbei mein Minimalbeispiel.
\usepackage{pgfplots} \newcounter{groupcount} \pgfplotsset{ compat=newest,% Lesetipp: http://texwelt.de/wissen/fragen/19163 /pgf/number format/1000 sep=\thinspace,% Abschnitt 92.1 Changing display styles in pgfmanual.pdf /pgf/number format/min exponent for 1000 sep=4, draw group line/.style n args={5}{% Quelle: https://tex.stackexchange.com/questions/71350 after end axis/.append code={ \setcounter{groupcount}{0} \pgfplotstableforeachcolumnelement{#1}\of\datatable\as\cell{% \def\temp{#2} \ifx\temp\cell \ifnum\thegroupcount=0 \stepcounter{groupcount} \pgfplotstablegetelem{\pgfplotstablerow}{[index]0}\of\datatable \coordinate [yshift=#4] (startgroup) at (axis cs:\pgfplotsretval,0); \else \pgfplotstablegetelem{\pgfplotstablerow}{[index]0}\of\datatable \coordinate [yshift=#4] (endgroup) at (axis cs:\pgfplotsretval,0); \fi \else \ifnum\thegroupcount=1 \setcounter{groupcount}{0} \draw [ shorten >=-#5, shorten <=-#5 ] (startgroup) -- node [anchor=north] {#3} (endgroup); \fi \fi } \ifnum\thegroupcount=1 \setcounter{groupcount}{0} \draw [ shorten >=-#5, shorten <=-#5 ] (startgroup) -- node [anchor=north] {#3} (endgroup); \fi } } } \pgfplotstableread[col sep=comma]{ 1, 84.40, 136.44, , 2013 2, 102.15, 136.44, , 2013 3, 124.75, 176.93, , 2014 4, 141.23, 175.18, , 2014 5, 172.36, 214.88, -5.70, 2014 6, 197.14, 213.67, 4.90, 2014 7, 184.26, 211.41, 10.21, 2015 8, 206.19, 216.73, -5.77, 2015 9, 178.19, 226.07, 45.43, 2015 10, 192.00, 207.53, 74.78, 2015 11, 175.27, 208.02, 34.56, 2016 12, 205.23, 232.20, 23.46, 2016 13, 225.17, 241.23, 39.99, 2016 14, 279.86, 277.36, 15.12, 2016 15, 273.97, 306.60, 4.73, 2017 16, 309.35, 310.56, 17.66, 2017 17, 310.64, 352.00, 3.20, 2017 18, 346.56, 359.00, 13.24, 2017 }\datatable \begin{document} \begin{tikzpicture} \begin{axis}[ ymin=1, ymax=400, ytick={0,50,...,400}, ylabel=Ranking, ymajorgrids, y dir=reverse, xtick=data, width=6.8in, legend pos=north west, xticklabel={ \pgfmathparse{mod(\tick+1,4)+1} Q\pgfmathprintnumber[int trunc]{\pgfmathresult} }, draw group line={[index]4}{2013}{2013}{-92.5ex}{7pt}, draw group line={[index]4}{2014}{2014}{-92.5ex}{7pt}, draw group line={[index]4}{2015}{2015}{-92.5ex}{7pt}, draw group line={[index]4}{2016}{2016}{-92.5ex}{7pt}, draw group line={[index]4}{2017}{2017}{-92.5ex}{7pt} ] \addplot[smooth, mark=*, blue] table[x index=0,y index=1] \datatable; \addplot[smooth, mark=*, green] table[x index=0,y index=2] \datatable; \legend{Ranking Games, Top Grossing} \end{axis} \begin{axis}[ yticklabel pos=right,% yticklabel auf der rechten Seite ymin=-50, ymax=200, xtick=\empty,% xticks nicht noch einmal zeichnen ylabel=Inflation, %ymajorgrids, width=6.8in, legend pos=north east ] \addplot[smooth, mark=*, red] table[x index=0,y index=3, skip coords between index={0}{3}] \datatable; \legend{Inflation} \end{axis} \end{tikzpicture}