Überarbeitungsverlauf[Zurück]
Klicke auf Einblenden/Ausblenden von Überarbeitungen 6
Ausgabe als Bild eingefügt

29 Jan '15, 11:14

stefan's gravatar image

stefan
18.4k163148

Durchschnittswerte berechnen in pgfplots Diagramm

Hallo zusammen, Ich spiele gerade mit folgendem pgfplots Beispiel. Testweise möchte ich, dass das erste Balken-Set (none, rrn fb, wfs), basierend auf den Daten für size=0 (input siehe unten) als Durchschnitt der Werte angezeigt wird: (300000+400000+500000)/3=400000. Jedoch zeigt mir pgfplots alle 3 Balken für die drei Werte 300000, 400000, 500000 separat und überlagert an. Gibt es einen simplen Befehl - zB. als Option für `\addplot table` - um den Durchschnittswert zu bilden? Hier der TeX-Code, Eingabedatei via `filecontents`-Umgebung eingebettet: \documentclass[12pt]{article} \usepackage[english]{babel} \usepackage[utf8x]{inputenc} \usepackage{amsmath} \usepackage{tikz} \usepackage{filecontents} \begin{filecontents}{06_mi_mm_tp-comparison.txt} size none rr fb wfs 0 300000 300000 300000 300000 0 400000 400000 400000 400000 0 500000 500000 500000 500000 1 605292 1521765 1629664 1750771 2 294844 1154284 1118936 1566752 3 0 0 0 0 \end{filecontents} \usepackage{pgfplots} \usetikzlibrary{shapes,chains,positioning,shadows} \pgfplotsset{compat=1.7} \usepgfplotslibrary{groupplots} \begin{document} \pgfplotstableread {06_mi_mm_tp-comparison.txt} {\loadedtable} \begin{figure}[!ht] \centering \begin{tikzpicture} \begin{axis}[ybar,%bar width=7pt, xlabel={UDP dtgr. size (Bytes)}, ylabel=Throughput (Mbit/s), grid=major, xtick=data, xticklabels = {250,500,1500,3000}, legend columns = 1, legend style={legend pos=outer north east},] %width=0.6\textwidth,] \addplot table[x=size, y=none] {\loadedtable}; \addplot table[x=size, y=rr] {\loadedtable}; \addplot table[x=size, y=fb] {\loadedtable}; \addplot table[x=size, y=wfs] {\loadedtable}; \legend{no mode,RR PS,Ext.RR PS,WFS PS} \end{axis} \end{tikzpicture} \caption{Throughput results of different packet scheduling modes} \label{fig:m-mm-tp-comp} \end{figure} \end{document} Die Ausgabe: ![Plot][1] Ich bin Anfänger mit pgfplots, und versuche den Code so einfach wie möglich zu halten. Ich freue mich über jeden Vorschlag. Danke. [1]: http://texwelt.de/wissen/upfiles/plot_1.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 5
Eingabedatei via filecontents eingebettet

29 Jan '15, 11:00

stefan's gravatar image

stefan
18.4k163148

Durchschnittswerte berechnen in pgfplots Diagramm

Hallo zusammen, Ich spiele gerade mit folgendem pgfplots Beispiel. Testweise möchte ich, dass das erste Balken-Set (none, rrn fb, wfs), basierend auf den Daten für size=0 (input siehe unten) als Durchschnitt der Werte angezeigt wird: (300000+400000+500000)/3=400000. Jedoch zeigt mir pgfplots alle 3 Balken für die drei Werte 300000, 400000, 500000 separat und überlagert an. Gibt es einen simplen Befehl - zB. als Option für `\addplot table` - um den Durchschnittswert zu bilden? Hier der tex code: TeX-Code, Eingabedatei via `filecontents`-Umgebung eingebettet: \documentclass[12pt]{article} \usepackage[english]{babel} \usepackage[utf8x]{inputenc} \usepackage{amsmath} \usepackage{tikz} \usepackage{filecontents} \begin{filecontents}{06_mi_mm_tp-comparison.txt} size none rr fb wfs 0 300000 300000 300000 300000 0 400000 400000 400000 400000 0 500000 500000 500000 500000 1 605292 1521765 1629664 1750771 2 294844 1154284 1118936 1566752 3 0 0 0 0 \end{filecontents} \usepackage{pgfplots} \usetikzlibrary{shapes,chains,positioning,shadows} \pgfplotsset{compat=1.7} \usepgfplotslibrary{groupplots} \begin{document} \pgfplotstableread {Measurements/06_mi_mm_tp-comparison.txt} {06_mi_mm_tp-comparison.txt} {\loadedtable} \begin{figure}[!ht] \centering \begin{tikzpicture} \begin{axis}[ybar,%bar width=7pt, xlabel={UDP dtgr. size (Bytes)}, ylabel=Throughput (Mbit/s), grid=major, xtick=data, xticklabels = {250,500,1500,3000}, legend columns = 1, legend style={legend pos=outer north east},] %width=0.6\textwidth,] \addplot table[x=size, y=none] {\loadedtable}; \addplot table[x=size, y=rr] {\loadedtable}; \addplot table[x=size, y=fb] {\loadedtable}; \addplot table[x=size, y=wfs] {\loadedtable}; \legend{no mode,RR PS,Ext.RR PS,WFS PS} \end{axis} \end{tikzpicture} \caption{Throughput results of different packet scheduling modes} \label{fig:m-mm-tp-comp} \end{figure} \end{document} Und hier der Inhalt meiner input txt Datei: size none rr fb wfs 0 300000 300000 300000 300000 0 400000 400000 400000 400000 0 500000 500000 500000 500000 1 605292 1521765 1629664 1750771 2 294844 1154284 1118936 1566752 3 0 0 0 0 Ich bin Anfänger mit pgfplots, und versuche den Code so einfach wie möglich zu halten. Ich freue mich über jeden Vorschlag. Danke.Danke.
Klicke auf Einblenden/Ausblenden von Überarbeitungen 4

29 Jan '15, 10:50

Christian_FFM's gravatar image

Christian_FFM
21113

Klicke auf Einblenden/Ausblenden von Überarbeitungen 3

29 Jan '15, 10:49

Christian_FFM's gravatar image

Christian_FFM
21113

Klicke auf Einblenden/Ausblenden von Überarbeitungen 2
Code markiert

29 Jan '15, 10:37

stefan's gravatar image

stefan
18.4k163148

Klicke auf Einblenden/Ausblenden von Überarbeitungen 1

29 Jan '15, 10:35

Christian_FFM's gravatar image

Christian_FFM
21113