Draw a sequence chart-use Gnuplot
A time sequence chart is a common data plot. The most typical time sequence data is weather data. The weather temperature and humidity change with time, this article provides an example of using gnuplot to plot the Real-Time Temperature and Humidity curve based on the data collected by the LAMOST meteorological station.
Weather data:
timemjdtemp rhumpres wind_avgwind_max wind_dir dewpoint2008-12-14 18:02:0078933242 -2.433915.52.64.276-16.462008-12-14 18:04:0078933244 -2.333915.62.84.675-16.382008-12-14 18:06:0078933246 -2.433915.62.74.680-16.462008-12-14 18:08:0078933248 -2.433915.62.75.275-16.462008-12-14 18:10:0078933250 -2.433915.53.87.178-16.462008-12-14 18:12:0078933252 -2.333915.63.36.476-16.382008-12-14 18:14:0078933254 -2.333915.62.85.974-16.382008-12-14 18:16:0078933256 -2.333915.53.5874-16.382008-12-14 18:18:0078933258 -2.333915.63.17.479-16.382008-12-14 18:20:0078933260 -2.333915.72.85.974-16.382008-12-14 18:22:0078933262 -2.334915.71.7480-16.022008-12-14 18:24:0078933264 -2.434915.72.64.176-16.112008-12-14 18:26:0078933266 -2.434915.82.5474-16.112008-12-14 18:28:0078933268 -2.333915.82.73.775-16.382008-12-14 18:30:0078933270 -2.233915.84.26.375-16.292008-12-14 18:32:0078933272 -2.133915.92.95.677-16.22008-12-14 18:34:0078933274 -2.234915.93.35.373-15.932008-12-14 18:36:0078933276 -2.234915.93.34.975-15.932008-12-14 18:38:0078933278 -2.234915.92.74.371-15.932008-12-14 18:40:0078933280 -2.234915.945.673-15.932008-12-14 18:42:0078933282 -2.133915.93.85.173-16.22008-12-14 18:44:0078933284 -2.133915.93.65.473-16.2...............
Watermark: The image size is 1000x1000.
Time series data must specify the time format. The format of the following example is:
set timefmt "%Y-%m-%d %H:%M:%S"
More time formats:
Format |
Description |
% D |
Date: 1-31 |
% M |
Month: 1-12 |
% Y |
Year: 0-99 |
% Y |
Year, four-digit |
% J |
Days in a year: 1-365 |
% H |
Hour: 0-23 |
% M |
Minute: 0-59 |
% S |
UNIX time |
% S |
Seconds: 0-59 |
% B |
Abbreviation of the month with three letters |
% B |
Month name |
The procedure is as follows:
Set terminal png font '. /font/fzht. ttf, 11 'size, set output "Release PNG" set multiplot layout 2, 1 title "LAMOST weather information" # set size ratio 0.4 set title "LAMOST weather information-relative humidity map of temperature dew point temperature" font '. /font/fzht. ttf, 13 'set xdata timeset xlabel "\ n time" set ylabel "temperature/dew point temperature (C)" set timefmt "% Y-% m-% d % H: % M: % S "set grid # set yrange [-3:6] set y2label" relative humidity (%) "set y2ticsplot 'w. dat 'using with line title "temperature", \ 'w. dat 'using with line title "Dew Point Temperature", \ 'W. dat 'using axes x1y2 with line title "relative humidity" # set title "LAMOST weather Info-wind speed atmospheric pressure Chart" font '. /font/fzht. ttf, 13 'set xdata timeset xlabel "\ n time" set ylabel "wind speed (m/s)" set timefmt "% Y-% m-% d % H: % M: % S "set grid # set nokeyset y2label" atmospheric pressure (hPa) "set y2ticsplot 'w. dat 'using with line title "instantaneous maximum wind speed", \ 'W. dat 'using with line title "average wind speed", \ 'W. dat 'using axes x1y2 with line title "Atmospheric Pressure"
Program name demo. gp, run the program:
gnuplot demo.gp
This article permanently updates the link address: