Größe der Graphik anpassen

Tabellen und Grafiken erstellen und anordnen


Basti88
Forum-Newbie
Forum-Newbie
Beiträge: 4
Registriert: Mi 16. Nov 2016, 13:31

Größe der Graphik anpassen

Beitrag von Basti88 »

Guten Tag,
ich schreibe mit Latex meine Bachelorarbeit, jetzt habe ich mir ein Balkendiagramm erstellt und die sieht an sich auch verwendbar aus.
Leider wird aber immer das Jahr 2015 nicht mit angezeigt, kann mir weiterhelfen, der Abgabetermin kommt leider immer näher.
Den Fehler habe ich nach dem % angehangen.
Ich möchte also die Graphik so haben, dass alle Werte angezeigt werden, die Größe ist erstmal nebensächlich.
Vielen Dank
Basti
\documentclass[12pt]{article} 
\usepackage[T1]{fontenc} 
\usepackage{pgfplots} 

\pgfplotsset{ 
  compat=1.13, 
  xlabel near ticks, 
  ylabel near ticks 
} 

\begin{document} 
  \begin{tikzpicture} 
    \begin{axis}[ 
      height=12cm, 
      width=17cm, 
      enlargelimits=0.01, 
      legend style={ 
        at={(0.5,-0.2)}, 
        anchor=north, 
        legend columns=-1 
      }, 
      ymin=0, 
      ymax=1.5, 
      x tick label style={/pgf/number format/1000 sep=}, 
      x tick label style={rotate=45,anchor=east}, 
      ylabel={Prozent}, 
      ybar interval=0.5,
    ] 
     \addplot coordinates { 
        (2010,1) 
        (2011,0) 
        (2012,1) 
        (2013,1.0573) 
        (2014,1.0943) 
        (2015,1.0902)  
      }; 
  \addplot coordinates { 
        (2010,1) 
        (2011,1.012) 
        (2012,1.0786) 
        (2013,1.1928) 
        (2014,1.2325) 
        (2015,1.2524)  
      }; 
    \addplot coordinates { 
        (2010,1) 
        (2011,1.025) 
        (2012,1.0281) 
        (2013,1.0134) 
        (2014,1.0003) 
        (2015,0.9963)  
      }; 
     \addplot coordinates { 
        (2010,1) 
        (2011,1.1163) 
        (2012,1.1492) 
        (2013,1.1733) 
        (2014,1.3098) 
        (2015,1.4590)  
      }; 
      \legend{Marktanteil, Bruttoumsatz, Anz. Filialen, Anz. Mitarbeiter} 
  \end{axis} 
  \end{tikzpicture} 
\end{document}
%Overfull \hbox (105.86665pt too wide) in paragraph at lines 63--64
[][] 
[1{/usr/local/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./Ohne-Titel.aux) )
(see the transcript file for additional information){/usr/local/texlive/2016/te
xmf-dist/fonts/enc/dvips/cm-super/cm-super-t1.enc}</usr/local/texlive/2016/texm
f-dist/fonts/type1/public/amsfonts/cm/cmmi12.pfb></usr/local/texlive/2016/texmf
-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr/local/texlive/2016/texmf-d
ist/fonts/type1/public/cm-super/sfrm1200.pfb>
Output written on Ohne-Titel.pdf (1 page, 31081 bytes).
SyncTeX written on Ohne-Titel.synctex.gz.
Transcript written on Ohne-Titel.log.

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Die von Dir angehangene Overfull \hbox hat mit Deinem Problem nichts zu tun. Sie besagt nur, dass Deine Zeichnung zu breit ist.

Aber ich bin mir sicher, dass Du bar und nicht bar intervall möchtest. Schau Dir den Unterschied einfach in der [d]pgfplots[/d] Doku an.
\documentclass[12pt]{article} 
\usepackage[T1]{fontenc} 
\usepackage{pgfplots} 

\pgfplotsset{ 
   compat=1.13, 
   xlabel near ticks, 
   ylabel near ticks 
} 

\begin{document} 
   \begin{tikzpicture} 
     \begin{axis}[ 
       height=12cm, 
       width=\linewidth, %<- schmaler gemacht
       enlargelimits=0.01, 
       legend style={ 
         at={(0.5,-0.2)}, 
         anchor=north, 
         legend columns=-1 
       }, 
       ymin=0, 
       ymax=1.5, 
       x tick label style={/pgf/number format/1000 sep=}, 
       x tick label style={rotate=45,anchor=east}, 
       ylabel={Prozent},
      % Anpassungen ab hier
       ybar,
       bar width=7pt,
       xtick=data,
       enlarge x limits={abs=30pt},
      minor x tick num=1,
      grid=minor
      % Anpassungen Ende
     ] 
      \addplot coordinates { 
         (2010,1) 
         (2011,0) 
         (2012,1) 
         (2013,1.0573) 
         (2014,1.0943) 
         (2015,1.0902)   
       }; 
   \addplot coordinates { 
         (2010,1) 
         (2011,1.012) 
         (2012,1.0786) 
         (2013,1.1928) 
         (2014,1.2325) 
         (2015,1.2524)   
       }; 
     \addplot coordinates { 
         (2010,1) 
         (2011,1.025) 
         (2012,1.0281) 
         (2013,1.0134) 
         (2014,1.0003) 
         (2015,0.9963)   
       }; 
      \addplot coordinates { 
         (2010,1) 
         (2011,1.1163) 
         (2012,1.1492) 
         (2013,1.1733) 
         (2014,1.3098) 
         (2015,1.4590)   
       }; 
       \legend{Marktanteil, Bruttoumsatz, Anz. Filialen, Anz. Mitarbeiter} 
   \end{axis} 
   \end{tikzpicture} 
\end{document}

Basti88
Forum-Newbie
Forum-Newbie
Beiträge: 4
Registriert: Mi 16. Nov 2016, 13:31

Beitrag von Basti88 »

Vielen Dank, für die schnelle Antwort.
Jetzt habe ich noch 2 Fragen zur Feinarbeit.
Erstens wie bekomme ich es hin, dass die Tabelle zum Balkendiagramm über den Diagramm erscheint?
Zweitens ich möchte der Graphik einen Namen zuweisen, sodass es beim Abbildungsverzeichnis aufgeführt wird.

Schon einmal vielen Dank für die Hilfe.
Hier ist der Code für die Tabelle plus dem Diagramm und in dieser Reihenfolge soll es auch ausgegeben werden:

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{pgfplots}
\usepackage{caption, booktabs}
\usepackage[table,xcdraw]{xcolor}

\begin{document}
\begin{table}[]
\centering
\caption{\textbf{LIDL GmbH $\&$ Co. KG}}
\label{my-label}
\begin{tabular}{@{}|l|c|c|c|c|c|c|@{}}
\toprule
\textbf{Jahr}                              & \textbf{2010}    & \textbf{2011}    & \textbf{2012}    & \textbf{2013}    & \textbf{2014}    & \textbf{2015}    \\ \midrule
\textbf{Marktanteil (in \%)}               & \textit{24,4}    & \textit{}        & \textit{24,4}    & \textit{25,8}    & \textit{26,7}    & \textit{26,6}    \\ \midrule
\textbf{Bruttoumsatz (in Millionen Euro)}  & \textit{16600,-} & \textit{16800,-} & \textit{17905,-} & \textit{19800,-} & \textit{20460,-} & \textit{20790,-} \\ \midrule
\textbf{Anz. der Filialen}                 & \textit{3202}    & \textit{3282}    & \textit{3292}    & \textit{3245}    & \textit{3203}    & \textit{3190}    \\ \midrule
\textbf{Anz. der Mitarbeiter}              & \textit{84223}   & \textit{94019}   & \textit{96790}   & \textit{98821}   & \textit{110319}  & \textit{122879}  \\ \midrule
\textbf{Flächenproduktivität (in Euro/qm)} & \textit{}        & \textit{}        & \textit{}        & \textit{}        & \textit{}        & \textit{6280,-}    \\ \midrule
\textbf{Verkaufsfläche (in qm)}            & \textit{}        & \textit{}        & \textit{2700604} & \textit{2663986} & \textit{2716799} & \textit{}        \\ \bottomrule
\end{tabular}
\end{table}

\pgfplotsset{ 
   compat=1.13, 
   xlabel near ticks, 
   ylabel near ticks 
} 

   \begin{tikzpicture} 
     \begin{axis}[ 
       height=12cm, 
       width=\linewidth,  
       enlargelimits=0.01, 
       legend style={ 
         at={(0.5,-0.2)}, 
         anchor=north, 
         legend columns=-1 
       }, 
       ymin=0, 
       ymax=1.5, 
       x tick label style={/pgf/number format/1000 sep=}, 
       x tick label style={rotate=45,anchor=east}, 
       ylabel={Prozent}, 
       ybar, 
       bar width=7pt, 
       xtick=data, 
       enlarge x limits={abs=30pt}, 
      minor x tick num=1, 
      grid=minor 
     ] 
      \addplot coordinates { 
         (2010,1) 
         (2011,0) 
         (2012,1) 
         (2013,1.0573) 
         (2014,1.0943) 
         (2015,1.0902)   
       }; 
   \addplot coordinates { 
         (2010,1) 
         (2011,1.012) 
         (2012,1.0786) 
         (2013,1.1928) 
         (2014,1.2325) 
         (2015,1.2524)   
       }; 
     \addplot coordinates { 
         (2010,1) 
         (2011,1.025) 
         (2012,1.0281) 
         (2013,1.0134) 
         (2014,1.0003) 
         (2015,0.9963)   
       }; 
      \addplot coordinates { 
         (2010,1) 
         (2011,1.1163) 
         (2012,1.1492) 
         (2013,1.1733) 
         (2014,1.3098) 
         (2015,1.4590)   
       }; 
       \legend{Marktanteil, Bruttoumsatz, Anz. Filialen, Anz. Mitarbeiter} 
   \end{axis} 
   \end{tikzpicture}
\end{document}

Bartman
Forum-Meister
Forum-Meister
Beiträge: 2456
Registriert: Do 16. Jul 2009, 21:41
Wohnort: Hessische Provinz

Beitrag von Bartman »

Die Argumentliste des Aufrufs von \pgfplotsset könntest Du noch um das Argument /pgf/number format/use comma erweitern, damit die Dezimaltrennzeichen der Beschriftung der y-Achse an die deutsche Dokumentsprache angepasst werden.
Basti88 hat geschrieben:Erstens wie bekomme ich es hin, dass die Tabelle zum Balkendiagramm über den Diagramm erscheint?
Zweitens ich möchte der Graphik einen Namen zuweisen, sodass es beim Abbildungsverzeichnis aufgeführt wird.
Für diese beiden von diesem Thema abweichenden Anliegen eröffnest Du besser ein Beispiel in einem neuen Thread.

Antworten