2020-11-13

GNUPLOT: Drawing chart in Linux Terminal

#sudo apt-get -y install gnuplot-nox
#sudo apt-get -y install gnuplot-qt
#sudo apt-get -y install gnuplot-x11
#sudo apt-get -y install plotutils

time (gnuplot < gpcommands.txt)



#gpcommands.txt
#9:16 2020.11.13
#https://bhoey.com/blog/simple-time-series-graphs-with-gnuplot/
#http://gnuplot.sourceforge.net/docs_4.2/node274.html
#https://alvinalexander.com/technology/gnuplot-charts-graphs-examples/

set xdata time                          # Indicate that x-axis values are time values

#2020.11.12-17:17:13
#set timefmt "%Y-%m-%d"                 # Indicate the pattern the time values will be in
set timefmt "%Y.%m.%d-%H:%M:%S"         # Indicate the pattern the time values will be in

#set format x "%m/%y"                   # Set how the dates will be displayed on the plot
set format x "%Y.%m.%d-%H:%M:%S"        # Set how the dates will be displayed on the plot
 
#set xrange ["2020.11.01-00:00:00":"2020.11.30-23:59:00"]  # Set x-axis range of values
#set yrange [0:30]                       # Set y-axis range of values
 
set key off                             # Turn off graph legend
set xtics rotate by -90                 # Rotate dates on x-axis 45deg for cleaner display
set title 'REDIS (2.2.2.124:6390) MONITOR CHART RESULT'  # Set graph title
 
set xlabel "Time (2020.11.12-17:17:04 --> 2020.11.13-07:51:37)"
set ylabel "Metric (ms)"
set autoscale y
set autoscale x
set xrange ["2020.11.12-17:00:00":"2020.11.13-08:00:00"]
set grid
set timestamp

#set terminal jpeg                       # Set the output format to jpeg
#set output 'output-2.jpg'               # Set output file to output.jpg

#set terminal png                       # Set the output format to PNG
#set terminal png size 1280, 1024
#set terminal png size 5000, 1024
set terminal png size 3000, 1024
#set terminal png size 1920, 1080
set output "RedisMetricMonitor.png"
 
#plot 'result.txt' using 1:2 with linespoints linetype 55000 linewidth 2
#plot 'result.txt' using 1:2 with lines linetype 55000 linewidth 2
#plot 'result.txt' using 1:2 with filledcurves linetype 55000 linewidth 2
plot 'result.txt' using 1:2 with lines



#result.txt
2020.11.12-17:17:04 0.36
2020.11.12-17:17:05 0.35
2020.11.12-17:17:06 0.34
2020.11.12-17:17:07 0.26
2020.11.12-17:17:08 0.41
2020.11.12-17:17:09 0.21
2020.11.12-17:17:10 0.23
2020.11.12-17:17:11 0.23
2020.11.12-17:17:12 0.31
2020.11.12-17:17:13 0.23




No comments:

Post a Comment