diff --git a/README.pod b/README.pod index 951a099..f5c45f4 100644 --- a/README.pod +++ b/README.pod @@ -21,56 +21,40 @@ Simple plotting of piped data: 10 25 $ seq 5 | awk '{print 2*$1, $1*$1}' | - feedgnuplot --lines --points --legend 0 "data 0" --title "Test plot" --y2 1 - --unset grid --terminal 'dumb 80,40' --exit + feedgnuplot \ + --lines \ + --points \ + --title "Test plot" \ + --y2 1 \ + --unset key \ + --unset grid \ + --terminal 'dumb 80,40' \ + --exit - Test plot - - 10 +-----------------------------------------------------------------+ 25 - | + + + + + + + *##| - | data 0 ***A*#* | - | ** # | - 9 |-+ ** ## | - | ** # | - | ** # | - | ** ## +-| 20 - 8 |-+ A # | - | ** # | - | ** ## | - | ** # | - | ** B | - 7 |-+ ** ## | - | ** ## +-| 15 - | ** # | - | ** ## | - 6 |-+ *A ## | - | ** ## | - | ** # | - | ** ## +-| 10 - 5 |-+ ** ## | - | ** #B | - | ** ## | - | ** ## | - 4 |-+ A ### | - | ** ## | - | ** ## +-| 5 - | ** ## | - | ** ##B# | - 3 |-+ ** #### | - | **#### | - | #### | - |## + + + + + + + | - 2 +-----------------------------------------------------------------+ 0 - 1 1.5 2 2.5 3 3.5 4 4.5 5 - -Here we asked for ASCII plotting, which is useful for documentation. +=for html

Simple real-time plotting example: plot how much data is received on the wlan0 -network interface in bytes/second (uses bash, awk and Linux): +network interface in bytes/second. This plot updates at 1Hz, and shows the last +10sec of history. The plot shown here is the final state of a sample run - $ while true; do sleep 1; cat /proc/net/dev; done | - gawk '/wlan0/ {if(b) {print $2-b; fflush()} b=$2}' | - feedgnuplot --lines --stream --xlen 10 --ylabel 'Bytes/sec' --xlabel seconds + $ while true; do + sleep 1; + cat /proc/net/dev; + done \ + | gawk '/wlan0/ {if(b) {print $2-b; N++; fflush()} b=$2} N==15 {exit}' \ + | feedgnuplot \ + --lines \ + --title "wlan0 throughput" \ + --stream \ + --xlen 10 \ + --ylabel 'Bytes/sec' \ + --xlabel seconds \ + --unset key \ + --unset grid \ + --terminal 'dumb 80,40' \ + --exit + +=for html

=head1 DESCRIPTION diff --git a/documentation-header-network-throughput-plot.svg b/documentation-header-network-throughput-plot.svg new file mode 100644 index 0000000..e9f5bde --- /dev/null +++ b/documentation-header-network-throughput-plot.svg @@ -0,0 +1,141 @@ + + + +Gnuplot +Produced by GNUPLOT 6.1 patchlevel 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + 50000 + + + + + 100000 + + + + + 150000 + + + + + 200000 + + + + + 250000 + + + + + 300000 + + + + + 6 + + + + + 8 + + + + + 10 + + + + + 12 + + + + + 14 + + + + + + + + + gnuplot_plot_1 + + + + + + + + + + + + Bytes/sec + + + + + seconds + + + + + + + wlan0 throughput + + + + + + + diff --git a/documentation-header-plot.svg b/documentation-header-plot.svg new file mode 100644 index 0000000..169795a --- /dev/null +++ b/documentation-header-plot.svg @@ -0,0 +1,204 @@ + + + +Gnuplot +Produced by GNUPLOT 6.1 patchlevel 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 1 + + + + + 1.5 + + + + + 2 + + + + + 2.5 + + + + + 3 + + + + + 3.5 + + + + + 4 + + + + + 4.5 + + + + + 5 + + + + + 0 + + + + + 5 + + + + + 10 + + + + + 15 + + + + + 20 + + + + + 25 + + + + + + + + + gnuplot_plot_1 + + + + + + + + + gnuplot_plot_2 + + + + + + + + + + + + + + + + + + + Test plot + + + + + + + diff --git a/extract_README.sh b/extract_README.sh index 2d9b2cf..641b8df 100755 --- a/extract_README.sh +++ b/extract_README.sh @@ -10,5 +10,28 @@ L<"slides"|https://github.com/dkogan/talk-feedgnuplot-vnlog/blob/master/feedgnup EOF +seq 5 | awk '{print 2*$1, $1*$1}' | + feedgnuplot \ + --lines \ + --points \ + --title "Test plot" \ + --y2 1 \ + --unset key \ + --unset grid \ + --hardcopy 'documentation-header-plot.svg' + + +< bin/feedgnuplot \ + awk '/^ *Test plot$/,/^ *1 +1.5 +2 +2.5/ \ + { if(!wrote_plot1) { print "=for html

"; \ + wrote_plot1 = 1; } \ + next; \ + } \ + /^ *wlan0 throughput$/,/seconds/ \ + { if(!wrote_plot2) { print "=for html

"; \ + wrote_plot2 = 1; } \ + next; \ + } \ + /=head1/,0 \ + { print }' >> README.pod -< bin/feedgnuplot awk '/=head1/,0' >> README.pod