Reputation: 35
I would like to know how the y can take value from the x (the x store the dates) i have the following dates
13/3/2014 218.11.11
12/4/2014 218.37.12
5/5/2014 218.31.34
7/5/2015 218.31.10
23/5/2014 218.32.21
4/6/2014 218.41.14
we have these dates and these ips i want store the ips in months example: 5/2014 - 3 IPS
in gnuplot the graph i want to print every how much ips has every month here is what i have until now
set xlabel 'Date'
set title 'Gnuplot test graph'
set ylabel 'IPS'
set terminal png size 1400,500
set datafile sep ','
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set xrange ["2009/3/27 00:00":"2014/4/11 22:28"]
set xtics nomirror rotate by -45
set grid
set term png
set output 'file.png'
plot 'data.dat'using 1:2 with points
Upvotes: 2
Views: 565
Reputation: 48390
In order to count the number of equal x-values, you can use plot ... smooth frequency
using a fixed number of 1
for the y-values:
set xdata time
set timefmt '%d/%m/%Y'
plot 'data.dat' using 1:(1) smooth frequency
This plots the number of entries for each day.
To group the values by month, you must normalize all values for a month to the first of this month. For this you can use the tm_mday
function, which gets you the day of the current month, based on a timestamp:
set yrange [0:*]
set xdata time
set timefmt '%d/%m/%Y'
set xrange['01/03/2014':'01/06/2014']
set xtics 30*24*60*60
set format x '%b %Y'
plot 'data.dat' using (timecolumn(1) - (tm_mday(timecolumn(1))-1)*24*60*60):(1) smooth frequency w lp pt 7 ps 2 notitle
Upvotes: 1