Ich hab nachfolgende Statistik erzeugt. Ich würde nun gerne bestimmte Ereignisse hervorheben und unter/neben dem Bild als Erläuterung angeben. Ungefähr wie in:

dieses Bild

Gegebenenfalls auch direkt, ohne Legendeneintrag, in die Statistik reinpacken, aber bei längeren Beschriftungen wird das wohl nicht passen. pin scheint wohl solche Einträge zu ermöglichen, aber wie?

Öffne in Overleaf
\begin{filecontents*}{GDP.csv}
        Jahr,Total,Jung,Mittel,Alt
                1990-01-01,2.5,4.9,2.2,1.6
                1991-01-01,4.3,9.9,3.2,3.1
                1992-01-01,5.3,10.0,4.3,4.4
                1993-01-01,5.3,11.5,4.2,4.0
                1994-01-01,4.9,11.0,3.7,3.5
                1995-01-01,3.7,8.4,2.6,3.7
                1996-01-01,3.9,7.7,3.0,3.7
                1997-01-01,2.7,6.0,2.1,2.0
                1998-01-01,2.0,4.4,1.4,2.0
                1999-01-01,2.3,4.7,1.7,2.0
                2000-01-01,2.3,4.8,1.7,1.6
                2001-01-01,3.3,7.2,2.7,1.9
                2002-01-01,3.3,8.2,2.5,1.9
                2003-01-01,3.1,8.1,2.0,2.5
                2004-01-01,2.6,7.2,1.7,1.3
                2005-01-01,2.9,8.2,1.8,1.5
                2006-01-01,2.3,7.1,1.3,1.1
                2007-01-01,3.0,8.2,2.0,1.6
                2008-01-01,7.2,16.0,6.1,3.4
                2009-01-01,7.6,16.2,6.3,4.2
                2010-01-01,7.1,14.6,5.6,5.2
                2011-01-01,6.0,13.6,4.6,4.1
                2012-01-01,5.4,10.7,4.6,3.2
                2013-01-01,5.0,10.0,4.3,2.8
                2014-01-01,4.0,8.7,3.2,2.6
                2015-01-01,3.0,6.5,2.5,1.8
                2016-01-01,2.5,4.9,2.2,1.6        
        \end{filecontents*}
        \documentclass[tikz]{standalone}
        \usepackage{pgfplots}
        \usepgfplotslibrary{dateplot}
        \usepackage[main=ngerman,icelandic,danish,frenchb]{babel}
        \usepackage[T1]{fontenc}
        \usepackage[utf8]{inputenc} 
         \usepackage[oldstyle,sflining]{libertine}
        \begin{document}

        \sffamily
        \begin{tikzpicture}
         %   \sffamily
              \begin{axis}[
              date ZERO=1990-01-01,
                date coordinates in=x,
                no marks,
                width=12cm,
                height=6cm,
                enlargelimits=false,
                xticklabel={\tiny\year},
                   xticklabel style={rotate=45,anchor=north east},
              xtick={1990-01-01,1991-01-01,1992-01-01,1993-01-01,1994-01-01,1995-01-01,1996-01-01,1997-01-01,1998-01-01,1999-01-01,2000-01-01,2001-01-01,2002-01-01,2003-01-01,2004-01-01,2005-01-01,2006-01-01,2007-01-01,2008-01-01,2009-01-01,2010-01-01,2011-01-01,2012-01-01,2013-01-01,2014-01-01,2015-01-01,2016-01-01},
                xtick pos=left,
                xtick align=outside,
                cycle multi list={mark list\nextlist color list},
                ymin=-0,ymax=17,
                ytick={0,1,2,3,4,...,17},
                yticklabel={\tiny\pgfmathprintnumber[verbatim]{\tick}\%},
                ytick style={draw=none},
                yticklabel pos=right,
                ymajorgrids=true,
               legend style={
                        draw=none,
                        legend cell align=left,
                        at={(0,1.05)},% <-
                        anchor=south west,% <-
                        legend image code/.code={
                            \filldraw[##1] (-.5ex,-.5ex) rectangle (1ex,1ex);
                        },
                      },
                      legend columns=-1% <-
                      ]   
        \addplot table[col sep=comma,x=Jahr,y={Total}] {GDP.csv};
            \addlegendentry{Total};
             \addplot table[col sep=comma,x=Jahr,y={Jung}] {GDP.csv};
                \addlegendentry{16--24};
                 \addplot table[col sep=comma,x=Jahr,y={Mittel}] {GDP.csv};
                    \addlegendentry{25--54};
                     \addplot table[col sep=comma,x=Jahr,y={Alt}] {GDP.csv};
                        \addlegendentry{55-74};
                                       \end{axis}
            \end{tikzpicture}
        \end{document}

gefragt 17 Dez '17, 18:19

Tischa's gravatar image

Tischa
1.4k27102128
Akzeptiert-Rate: 15%

bearbeitet 07 Feb '18, 07:57

saputello's gravatar image

saputello
11.1k154365


Man kann einfach einen ycomb hinzufügen.

Öffne in Overleaf
    \begin{filecontents*}{GDP.csv}
    Jahr,Total,Jung,Mittel,Alt
            1990-01-01,2.5,4.9,2.2,1.6
            1991-01-01,4.3,9.9,3.2,3.1
            1992-01-01,5.3,10.0,4.3,4.4
            1993-01-01,5.3,11.5,4.2,4.0
            1994-01-01,4.9,11.0,3.7,3.5
            1995-01-01,3.7,8.4,2.6,3.7
            1996-01-01,3.9,7.7,3.0,3.7
            1997-01-01,2.7,6.0,2.1,2.0
            1998-01-01,2.0,4.4,1.4,2.0
            1999-01-01,2.3,4.7,1.7,2.0
            2000-01-01,2.3,4.8,1.7,1.6
            2001-01-01,3.3,7.2,2.7,1.9
            2002-01-01,3.3,8.2,2.5,1.9
            2003-01-01,3.1,8.1,2.0,2.5
            2004-01-01,2.6,7.2,1.7,1.3
            2005-01-01,2.9,8.2,1.8,1.5
            2006-01-01,2.3,7.1,1.3,1.1
            2007-01-01,3.0,8.2,2.0,1.6
            2008-01-01,7.2,16.0,6.1,3.4
            2009-01-01,7.6,16.2,6.3,4.2
            2010-01-01,7.1,14.6,5.6,5.2
            2011-01-01,6.0,13.6,4.6,4.1
            2012-01-01,5.4,10.7,4.6,3.2
            2013-01-01,5.0,10.0,4.3,2.8
            2014-01-01,4.0,8.7,3.2,2.6
            2015-01-01,3.0,6.5,2.5,1.8
            2016-01-01,2.5,4.9,2.2,1.6        
    \end{filecontents*}
    \begin{filecontents*}{SPECIAL.csv}
    Jahr,Event
            1992-01-01,1
            1996-01-01,2
            2001-01-01,3
            2006-01-01,4
            2011-01-01,5
            2014-01-01,6
    \end{filecontents*}
    \documentclass[tikz]{standalone}
    \usepackage{pgfplots}
    \pgfplotsset{compat=1.15}
    \usetikzlibrary{plotmarks}
    \usepgfplotslibrary{dateplot}
    \usepackage[main=ngerman,icelandic,danish,frenchb]{babel}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc} 
     \usepackage[oldstyle,sflining]{libertine}
    \begin{document}

    \sffamily
    \begin{tikzpicture}
     %   \sffamily
          \begin{axis}[
          date ZERO=1990-01-01,
            date coordinates in=x,
            width=12cm,
            height=6cm,
            no marks,
            enlargelimits=false,
            xticklabel={\tiny\year},
               xticklabel style={rotate=45,anchor=north east},
          xtick={1990-01-01,1991-01-01,1992-01-01,1993-01-01,1994-01-01,1995-01-01,1996-01-01,1997-01-01,1998-01-01,1999-01-01,2000-01-01,2001-01-01,2002-01-01,2003-01-01,2004-01-01,2005-01-01,2006-01-01,2007-01-01,2008-01-01,2009-01-01,2010-01-01,2011-01-01,2012-01-01,2013-01-01,2014-01-01,2015-01-01,2016-01-01},
            xtick pos=left,
            xtick align=outside,
            cycle multi list={mark list\nextlist color list},
            ymin=-0,ymax=17,
            ytick={0,1,2,3,4,...,17},
            yticklabel={\tiny\pgfmathprintnumber[verbatim]{\tick}\%},
            ytick style={draw=none},
            yticklabel pos=right,
            ymajorgrids=true,
           legend style={
                    draw=none,
                    legend cell align=left,
                    at={(0,1.05)},% <-
                    anchor=south west,% <-
                    legend image code/.code={
                        \filldraw[##1] (-.5ex,-.5ex) rectangle (1ex,1ex);
                    },
                  },
                  legend columns=-1% <-
                  ]   
    \addplot table[col sep=comma,x=Jahr,y={Total}] {GDP.csv};
        \addlegendentry{Total};
         \addplot table[col sep=comma,x=Jahr,y={Jung}] {GDP.csv};
            \addlegendentry{16--24};
             \addplot table[col sep=comma,x=Jahr,y={Mittel}] {GDP.csv};
                \addlegendentry{25--54};
                 \addplot table[col sep=comma,x=Jahr,y={Alt}] {GDP.csv};
                    \addlegendentry{55-74};
   \addplot+[gray,ycomb, nodes near coords={\coordindex},
   nodes near coords style={circle,draw,inner sep=0pt,font=\sffamily}] 
   table[col sep=comma,x=Jahr,y expr={15.5}] {SPECIAL.csv};
        \end{axis}
        \end{tikzpicture}
    \end{document}

alt text

Permanenter link

beantwortet 09 Apr '18, 06:11

Community's gravatar image

Community
21
Akzeptiert-Rate: 56%

Deine Antwort
Vorschau umschalten

Folgen dieser Frage

Per E-Mail:

Wenn sie sich anmelden, kommen Sie für alle Updates hier in Frage

Per RSS:

Antworten

Antworten und Kommentare

Markdown-Grundlagen

  • *kursiv* oder _kursiv_
  • **Fett** oder __Fett__
  • Link:[Text](http://url.com/ "Titel")
  • Bild?![alt Text](/path/img.jpg "Titel")
  • nummerierte Liste: 1. Foo 2. Bar
  • zum Hinzufügen ein Zeilenumbruchs fügen Sie einfach zwei Leerzeichen an die Stelle an der die neue Linie sein soll.
  • grundlegende HTML-Tags werden ebenfalls unterstützt

Frage-Themen:

×296
×32

gestellte Frage: 17 Dez '17, 18:19

Frage wurde gesehen: 4,382 Mal

zuletzt geändert: 09 Apr '18, 06:11