Namen für Diagramm vergeben und Anordnung einer Tabelle

Tabellen und Grafiken erstellen und anordnen


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

Namen für Diagramm vergeben und Anordnung einer Tabelle

Beitrag von Basti88 »

Guten Tag,
wie gewünscht eröffne ich ein eigenes Thread.
Ich möchte gerne das die Tabelle oberhalb der Graphik ausgegeben wird und das ich der Graphik einen Namen zuweisen kann, sodass es im Abbildungsverzeichnis auftaucht, benötigt wird das für eine BA.
\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}
Zuletzt geändert von Basti88 am Do 17. Nov 2016, 17:04, insgesamt 1-mal geändert.

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

Beitrag von Bartman »

Wie Du siehst, ist Deine Tabelle zu breit.

Mein Vorschlag, falls Tabelle und Diagramm auf einer Seite erscheinen sollen:
\documentclass[12pt,table]{article}% Option table für das von pgfplots geladene xcolor

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{pgfplots}% lädt xcolor
\usepackage{caption}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{showframe}

\pgfplotsset{
   compat=1.14,
   /pgf/number format/use comma,
   xlabel near ticks,
   ylabel near ticks
}

\begin{document}
\listoffigures
\listoftables

\newpage

\begin{center}
\begin{minipage}{\textwidth}
\centering
\scriptsize
\renewcommand{\arraystretch}{1.6}
\newcommand{\thead}[1]{\normalfont\bfseries #1}
\captionsetup{textfont=bf}
\captionof{table}{LIDL GmbH \& Co. KG}
\label{my-label}
\begin{tabularx}{\textwidth}{
	>{\bfseries\raggedright\hspace{0pt}}X
	*6{>{\itshape}r}
}
\toprule
Jahr                              & \thead{2010} & \thead{2011} & \thead{2012} & \thead{2013} & \thead{2014} & \thead{2015}\\
\midrule
Marktanteil (in \%)               & 24,4         &              & 24,4         & 25,8         & 26,7         & 26,6        \\
Bruttoumsatz (in Millionen Euro)  & 16600,--     & 16800,--     & 17905,--     & 19800,--     & 20460,--     & 20790,--    \\
Anz. der Filialen                 & 3202         & 3282         & 3292         & 3245         & 3203         & 3190        \\ 
Anz. der Mitarbeiter              & 84223        & 94019        & 96790        & 98821        & 110319       & 122879      \\
Flächenproduktivität (in~Euro/qm) &              &              &              &              &              & 6280,--     \\
Verkaufsfläche (in qm)            &              &              & 2700604      & 2663986      & 2716799      &             \\
\bottomrule
\end{tabularx}
\end{minipage}
\end{center}

\begin{center}
\begin{minipage}{\textwidth}
\centering
\begin{tikzpicture}[scale=.95, transform shape]
\begin{axis}[
	height=12cm,
	width=\linewidth,
	enlargelimits=0.01,
	legend style={
		at={(0.5,-0.2)},
		anchor=south,
		legend columns=-1
	},
	ymin=0,
	ymax=1.5,
	x tick label style={
		/pgf/number format/1000 sep=,
		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}
\captionof{figure}{Beschriftung}
\end{minipage}
\end{center}
\end{document}
Zuletzt geändert von Bartman am Do 17. Nov 2016, 20:22, insgesamt 2-mal geändert.

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

Beitrag von Basti88 »

Vielen Dank,
ich habe es nochmal ein wenig angepasst, aber die Lösung mit dem Minipage hat geholfen.
Gruß
Basti

Antworten