Graphen (Tikzpictures) gruppieren
Alles klar, danke.
Die letzten Probleme, die ich jetzt noch habe sind, dass ich gerne bei den rechten Graphen die Y-Achsenzahlen auf beiden Seiten hätte und dass durch das einschränken der width ein paar Markierungen auf der X-Achse wegfallen, die allerdings da sein sollten (vorher 25,26,27,28,29,30,31 nachher 26,28,30).
Zusätzlich würde ich die X-Achsen Beschriftung der nebeinanderliegenden Graphen zusammenführen, da diese ja identisch sind.
Die letzten Probleme, die ich jetzt noch habe sind, dass ich gerne bei den rechten Graphen die Y-Achsenzahlen auf beiden Seiten hätte und dass durch das einschränken der width ein paar Markierungen auf der X-Achse wegfallen, die allerdings da sein sollten (vorher 25,26,27,28,29,30,31 nachher 26,28,30).
Zusätzlich würde ich die X-Achsen Beschriftung der nebeinanderliegenden Graphen zusammenführen, da diese ja identisch sind.
Alles klar, vielen Dank. Soweit sieht alles genau so aus wie ich möchte.
2 Sachen allerdings noch nicht:
1. Wenn ich nur 3 Graphen im Groupplot habe, möchte ich gerne, dass der untere Graph mittig unter den beiden oberen ist.
2. Ich würde gerne 1 X-Achsen-Beschriftung (xlabel) für zwei nebeneinanderliegende Graphen haben.
2 Sachen allerdings noch nicht:
1. Wenn ich nur 3 Graphen im Groupplot habe, möchte ich gerne, dass der untere Graph mittig unter den beiden oberen ist.
2. Ich würde gerne 1 X-Achsen-Beschriftung (xlabel) für zwei nebeneinanderliegende Graphen haben.
How to center align a single plot within a row of groupplotDEVV hat geschrieben:1. Wenn ich nur 3 Graphen im Groupplot habe, möchte ich gerne, dass der untere Graph mittig unter den beiden oberen ist.
Ein Vorschlag auf der Grundlage Deines letzten Beispiels:DEVV hat geschrieben:2. Ich würde gerne 1 X-Achsen-Beschriftung (xlabel) für zwei nebeneinanderliegende Graphen haben.
\documentclass[a4paper,11pt,ngerman]{book} %\usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{fullpage} \usepackage{pgfplots} \usepackage{showframe} \usepgfplotslibrary{groupplots} \usetikzlibrary{matrix} \pgfplotsset{compat=1.16} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \begin{figure} \centering \begin{tikzpicture}[scale=.9] \begin{groupplot}[group style={group name=myplot, group size=2 by 2, vertical sep=64pt, horizontal sep=12pt}, grid=both, grid style=dashed] \nextgroupplot[title={\textbf{Durchsatz:} Erzeugung}, ylabel={Durchsatz [Mebibyte / Sekunde]}%, xlabel={Elemente in der Datenstruktur [$\log_2(n)$]} ] \addplot coordinates { (25.0,27.2706) (26.0,27.6152) (27.0,27.0114) (28.0,25.4822) (29.0,23.6201) (30.0,18.3911) }; \label{plots:plot1} \addplot coordinates { (25.0,19.4066) (26.0,21.0439) (27.0,24.2483) (28.0,25.7858) (29.0,25.2643) (30.0,23.2176) (31.0,21.5053) }; \label{plots:plot2} \addplot coordinates { (25.0,25.8846) (26.0,25.6254) (27.0,24.5522) (28.0,23.8694) (29.0,22.3375) (30.0,18.2088) }; \label{plots:plot3} \addplot coordinates { (25.0,20.732) (26.0,22.2468) (27.0,25.0059) (28.0,26.3556) (29.0,24.6092) (30.0,22.1791) (31.0,20.697) }; \label{plots:plot4} \nextgroupplot[title={\textbf{Durchsatz:} Vorgängeranfrage}, yticklabel pos=right, %xlabel={Elemente in der Datenstruktur [$\log_2(n)$]}, ylabel={Durchsatz [Millionen Anfragen / Sekunde]} ] \addplot coordinates { (25.0,2.197) (26.0,2.06646) (27.0,1.97961) (28.0,1.8256) (29.0,1.56041) (30.0,0.776778) }; \addplot coordinates { (25.0,3.15803) (26.0,2.24898) (27.0,2.12293) (28.0,1.98624) }; \addplot coordinates { (25.0,2.14384) (26.0,2.06185) (27.0,1.98044) (28.0,1.8621) (29.0,1.75767) (30.0,0.845749) }; \addplot coordinates { (25.0,3.00063) (26.0,2.43515) (27.0,2.11192) (28.0,2.04601) (31.0,0.887256) }; \nextgroupplot[title={\textbf{Speicherplatz:} Nach Erzeugung}, %xlabel={Elemente in der Datenstruktur [$\log_2(n)$]}, ylabel={Speicherverbrauch [Gigabyte]} ] \addplot coordinates { (25.0,1.83424) (26.0,3.78422) (27.0,8.48936) (28.0,19.8347) (29.0,46.6281) (30.0,121.489) (31.0,254.124) }; \addplot coordinates { (25.0,3.06541) (26.0,5.35606) (27.0,8.42623) (28.0,15.1457) (29.0,31.0536) (30.0,68.7423) (31.0,153.308) }; \addplot coordinates { (25.0,1.80516) (26.0,3.71904) (27.0,8.28671) (28.0,19.1333) (29.0,44.2815) (30.0,114.652) (31.0,238.808) }; \addplot coordinates { (25.0,2.82335) (26.0,4.98529) (27.0,8.04859) (28.0,14.6836) (29.0,30.0445) (30.0,65.7417) (31.0,143.733) }; \nextgroupplot[title={\textbf{Speicherplatz:} Während Erzeugung}, yticklabel pos=right, %xlabel={Elemente in der Datenstruktur [$\log_2(n)$]}, ylabel={Speicherverbrauch [Gigabyte]} ] \addplot coordinates { (25.0,1.83424) (26.0,3.78422) (27.0,8.48936) (28.0,19.8347) (29.0,46.6281) (30.0,121.489) (31.0,254.124) }; \addplot coordinates { (25.0,3.06541) (26.0,5.35606) (27.0,8.42623) (28.0,15.1457) (29.0,31.0536) (30.0,68.7423) (31.0,153.308) }; \addplot coordinates { (25.0,1.80516) (26.0,3.71904) (27.0,8.28671) (28.0,19.1333) (29.0,44.2815) (30.0,114.652) (31.0,238.808) }; \addplot coordinates { (25.0,2.82335) (26.0,4.98529) (27.0,8.04859) (28.0,14.6836) (29.0,30.0445) (30.0,65.7417) (31.0,143.733) }; \end{groupplot} \path (myplot c1r1.outer north west)% plot in column 1 row 1 -- node[anchor=south,rotate=90] {Gleichverteilung}% label midway (myplot c1r2.outer south west)% plot in column 1 row 2 ; % Beschriftung der x-Achse für die beiden oberen Diagramme \path (myplot c1r1.south east)% plot in column 1 row 1 -- node[below=5mm, font=\small] {Daten Elemente in der Datenstruktur [$\log_2(n)$]}% label midway (myplot c2r1.south west)% plot in column 2 row 2 ; \path (myplot c1r2.south east)% plot in column 1 row 2 -- coordinate (midway below)% label midway (myplot c2r2.south west)% plot in column 2 row 2 ; % Beschriftung der x-Achse für die beiden unteren Diagramme \node [anchor=north, font=\small] at (midway below|-current bounding box.south) {Daten Elemente in der Datenstruktur [$\log_2(n)$]}; %Legend \path (myplot c1r1.north west|-current bounding box.north)-- coordinate(legendpos) (myplot c2r1.north east|-current bounding box.north); \matrix[ matrix of nodes, anchor=south, draw, inner sep=0.2em, draw ]at([yshift=1ex]legendpos) { \ref{plots:plot1}& 1&[5pt] \ref{plots:plot2}& 2&[5pt] \ref{plots:plot3}& 3&[5pt] \ref{plots:plot4}& 4\\ }; \end{tikzpicture} \caption{\dots} \label{plot:uniform_hm_u40} \end{figure} \end{document}
Danke. Das funktioniert so.
Jetzt bin ich allerdings mal wieder auf ein weiteres Problem gestoßen. Statt ein neues Thema zueröffnen, benutz ich dieses mal weiter.
Ich habe die Legende so voll, dass scheinbar die Farbwahl von Tikzpicture das erste und letzte Legendenelement die selbe Farbe gibt. Das ist etwas dumm. Vorallem da man am vorletzten Element sieht, dass da noch Spielraum wäre (Raute Braun z.B.)...
MB:
Jetzt bin ich allerdings mal wieder auf ein weiteres Problem gestoßen. Statt ein neues Thema zueröffnen, benutz ich dieses mal weiter.
Ich habe die Legende so voll, dass scheinbar die Farbwahl von Tikzpicture das erste und letzte Legendenelement die selbe Farbe gibt. Das ist etwas dumm. Vorallem da man am vorletzten Element sieht, dass da noch Spielraum wäre (Raute Braun z.B.)...
MB:
% -*- mode: latex; mode: flyspell; ispell-local-dictionary: "en_US"; coding: utf-8; fill-column: 80 -*- \documentclass[a4paper,11pt,twoside,ngerman,color]{book} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{amsmath,amsfonts,amssymb} \usepackage{fullpage} \usepackage{verbatim} \usepackage{tikz,pgfplots} % Für LaTeX Graphiken \usepgfplotslibrary{groupplots} \usetikzlibrary{snakes,shapes,arrows,matrix,positioning, calc} \pgfplotsset{compat=1.6} \usetikzlibrary{pgfplots.groupplots} \usetikzlibrary{automata,arrows,backgrounds,decorations.markings,decorations.pathmorphing,decorations.pathreplacing,fit,positioning,shadows,shapes,shapes.geometric} \begin{document} \begin{figure} \begin{center} \begin{tikzpicture} \begin{groupplot}[group style={group name=myplot, group size=2 by 1, vertical sep=64pt, horizontal sep=12pt}, grid=both, grid style=dashed, width=.49\textwidth] \nextgroupplot[title={\textbf{Graph1}}, ylabel={Durchsatz Initialisierung [Mebibyte/s]}] \addplot coordinates { (1.36803,29.0662) }; \label{plots:u64_compare_1} \addplot coordinates { (1.19299,14.2032) }; \label{plots:u64_compare_2} \addplot coordinates { (1.42115,28.5889) }; \label{plots:u64_compare_3} \addplot coordinates { (1.04256,9.70903) }; \label{plots:u64_compare_4} \addplot coordinates { (0.597998,4.86066) }; \label{plots:u64_compare_5} \addplot coordinates { (0.922439,6.07058) }; \label{plots:u64_compare_6} \addplot coordinates { (0.920864,17.9675) }; \label{plots:u64_compare_7} \nextgroupplot[title={\textbf{Graph2}}, yticklabel pos=right] \addplot coordinates { (1.1372,35.6696) }; \addplot coordinates { (1.24863,19.6254) }; \addplot coordinates { (1.11562,32.8684) }; \addplot coordinates { (1.32014,16.8077) }; \addplot coordinates { (0.561978,5.48867) }; \addplot coordinates { (0.962332,9.48913) }; \addplot coordinates { (0.922897,25.6545) }; \addplot coordinates { (0.75884,58.4611) }; \label{plots:u64_compare_8} \addplot coordinates { (1.03236,52.9083) }; \label{plots:u64_compare_9} \addplot coordinates { (1.01033,43.4565) }; \label{plots:u64_compare_10} \addplot coordinates { (0.597396,7.14665) }; \label{plots:u64_compare_11} \end{groupplot} \path (myplot c1r1.south east)% plot in column 1 row 1 -- node[below=5mm, font=\small] {Durchsatz Vorgänger-Methode [Millionen Anfragen / Sekunde]}% label midway (myplot c2r1.south west)% plot in column 2 row 2 ; %Legend \path (myplot c1r1.south west|-current bounding box.south)-- coordinate(legendpos) (myplot c2r1.south east|-current bounding box.south); \matrix[ matrix of nodes, anchor=south, draw, inner sep=0.2em, outer sep=-50pt, draw ]at([yshift=1ex]legendpos) { \ref{plots:u64_compare_1}& 1&[5pt] \ref{plots:u64_compare_2}& 2&[5pt] \ref{plots:u64_compare_3}& 3&[5pt] \ref{plots:u64_compare_4}& 4&[5pt] \\ \ref{plots:u64_compare_5}& 5&[5pt] \ref{plots:u64_compare_6}& 6&[5pt] \ref{plots:u64_compare_7}& 7&[5pt] \ref{plots:u64_compare_8}& 8&[5pt] \\ \ref{plots:u64_compare_9}& 9&[5pt] \ref{plots:u64_compare_10}& 10&[5pt] \ref{plots:u64_compare_11}& 11 \\ }; \end{tikzpicture} \end{center} \caption{Text} \label{plot:speed_normal_u64} \end{figure} \end{document}
Es wäre für die Übersicht aber besser, ein neues Thema zu starten, damit dieses nicht durch etliche Fragen aufgebläht wird.
Möglicherweise hilft Dir der Abschnitt 4.7.7 "Cycle Lists – Options Controlling Line Styles".
Du brauchst am Ende einer Zeile der Matrix keine weitere Spalte. Der waagerechte Abstand betrifft nur den Raum zwischen den Spalten.
Möglicherweise hilft Dir der Abschnitt 4.7.7 "Cycle Lists – Options Controlling Line Styles".
Du brauchst am Ende einer Zeile der Matrix keine weitere Spalte. Der waagerechte Abstand betrifft nur den Raum zwischen den Spalten.
\ref{plots:u64_compare_1}& 1&[5pt] \ref{plots:u64_compare_2}& 2&[5pt] \ref{plots:u64_compare_3}& 3&[5pt] \ref{plots:u64_compare_4}& 4\\ \ref{plots:u64_compare_5}& 5&[5pt] \ref{plots:u64_compare_6}& 6&[5pt] \ref{plots:u64_compare_7}& 7&[5pt] \ref{plots:u64_compare_8}& 8\\ \ref{plots:u64_compare_9}& 9&[5pt] \ref{plots:u64_compare_10}& 10&[5pt] \ref{plots:u64_compare_11}& 11\\