Last active
October 9, 2015 17:57
-
-
Save ramn/3552277 to your computer and use it in GitHub Desktop.
Gnuplot examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create svg graph file | |
cat plotdata_raw | gnuplot -e "set terminal svg; plot '-' using 2:1 with lines" > my_graph.svg | |
# where plotdata_raw is a file with data, 2 columns separated by whitespace. | |
# using 2:1 means: use column 2 as x, column 1 as y axis | |
# with lines: draw a line graph | |
# Parse time | |
cat plotdata_raw | gnuplot -e "set xdata time; set timefmt '%s'; plot '-' using 2:1 with lines" -p | |
# With time range defined | |
# set xrange is not necessary, if left out gnuplot will round up to next whole hour | |
cat plotdata_raw | gnuplot -e "set xdata time; set timefmt '%s'; set xrange ['1346290193':'1346317667']; plot '-' using 2:1 with lines" -p | |
# Append gnuplot commands earlier in the pipe | |
cat plotdata_raw | (echo "plot '-' using 2:1 with lines"; cat) | gnuplot -p | |
# Smooth curve | |
cat plotdata_raw | gnuplot -e "set terminal svg; plot '-' using 2:1:(1.0) smooth acsplines with lines" > my_graph.svg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment