Wir können die Spitzen in GNUplot dank der Antwort in diesem Blog (Find local maximum of data files in gnuplot) plotten. Hier ist mein Skript.GNUplot: Verwenden von Variablen in der Legende
xcolumn=1
ycolumn=0
count = 0
plot "test.csv" u (column(xcolumn)):(column(ycolumn)) title "freq" w l, \\
"test.csv" u (column(0)==0 ? (last2y=column(ycolumn), \\
last2x=column(xcolumn), 1/0) : column(0)==1 ? (lasty=column(ycolumn), \\
lastx=column(xcolumn), 1/0) : lastx) \\
: \\
(column(0) < 2 ? 1/0 : (last2y <= lasty && \\
column(ycolumn) < lasty) ? (value=lasty, last2y=lasty, last2x=lastx, \\
count = count +1, \\
lasty=column(ycolumn), lastx=column(xcolumn), value) : (last2y=lasty, \\
last2x=lastx, lasty=column(ycolumn), lastx=column(xcolumn), 1/0)) title sprintf("Peaks %d", count) pt 7
Das Problem ist nun, den Wert von count
zum legnd hinzuzufügen. Ich habe versucht, als title sprintf("Peaks %d", count)
wie gezeigt als die letzte Zeile meines Skripts oben gegeben, aber es gibt 0 zurück. Wenn ich print count
nach dem Plot-Block, gibt es 23. Wie können wir den Wert einer Variablen der Legende in GNUplot hinzufügen? Jede Hilfe wäre willkommen.
Sie die Farbe mit 'lc [Nummer] ändern kann'; jede Zahl entspricht einer Farbe. Auch 'lc rgb" blau "usw. sollte funktionieren. – Miguel
danke und es funktioniert! – Mahsolid
Vielen Dank für die Hilfe Miguel. Sie sind sehr hilfreich. Ich bemühe mich, die falsch positiven zu ignorieren und stellte eine andere Frage: http://stackoverflow.com/questions/40946762/how-to-control-false-positives-in-gnuplot – Mahsolid