The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

carminat (49) [Avatar] Offline
#1
I have a file which contains one column only; each record in this columns is a date (in a format like 6/23/2014 for 23rd June 2014) and represents the date somebody has signed in a non-profit biking organization I am a member of. The real file is here: https://dl.dropboxusercontent.com/u/10917026/FIABpisa2015-members.txt

Our organization acquires new members mainly during special events (bike rides mainly); so many of these records are just repeated.
I would like to generate a frequency bar plot recording the date which corresponds to every single bar, but I have some problem dealing with the date format (added: I have solved some issues about the date format, but I still have troubles with the "set table" directive - due to date format I guess). Any suggestion?



PS: (just to better explain what I am aiming at) since events are often repeated year after year, we would like to be able to assess which events had a particularly good outcome or those which were unsuccessful, in order to improve.

philipp.janert (286) [Avatar] Offline
#2
Like so?

set xdata time
set timefmt "%m/%d/%Y"
set boxwid 10000
set xtics rotate

plot "FIABpisa2015-members.txt" u 1:(1) s freq w boxes

carminat (49) [Avatar] Offline
#3
philipp.janert wrote:Like so?

set xdata time
set timefmt "%m/%d/%Y"
set boxwid 10000
set xtics rotate

plot "FIABpisa2015-members.txt" u 1:(1) s freq w boxes



Thanks! That is not exactly what I was thinking of, but it is useful, indeed.

One more question: I have again several data series which are relative to the same period, but shifted of one (two, three, ...) year(s).

Let us say I have 3 dataset which describe the same phenomenon relative to the periods
1oct2015-31dec2016
1oct2014-31dec2015
1oct2013-31dec2014

I would like to plot these tree datasets on the same graph, just doing a translation in time of one (or two -respectively year(s) in order get them "superposed".
(OK, there could be a issue with the leap year day, but I would not care so much).

Is it doable?
philipp.janert (286) [Avatar] Offline
#4
If your data set is

1oct2015 1
1oct2014 2
1oct2013 3
1nov2014 5

you can do:

set xdata time
set datefmt "%d%b"
plot "file" u (strcol(1)[1:4]):2 w lp

The basic idea is to use string operations on the date column in the "using" spec.
carminat (49) [Avatar] Offline
#5
philipp.janert wrote:If your data set is

1oct2015 1
1oct2014 2
1oct2013 3
1nov2014 5

you can do:

set xdata time
set datefmt "%d%b"
plot "file" u (strcol(1)[1:4]):2 w lp

The basic idea is to use string operations on the date column in the "using" spec.


Actually this is not yet what I need.

If I understand well, the problem is that with this method is that we are just "forgetting" about the year.

And yet I would like to compare phenomena which
(1) take place on a period of time which is not contained in a single year;
(2) this period of time spans 14 months (rather than 12)

If I had numeric values, I would just perform a translation. So one way to gain my goal would be transforming every date in a number (for instance measuring how many days have passed since 1jan2000), so that to compare the data one can just make an appropriate shift in time.

However I thought this issue could be something that can be solved inside gnuplot (but I am still not enough familiar with time series).

Just to be more clear, here are two of the typical files I have to compare
https://dl.dropboxusercontent.com/u/10917026/1415.dat
https://dl.dropboxusercontent.com/u/10917026/1516.dat
(in the end I intend to plot them with the "smooth cumulative" directve)
philipp.janert (286) [Avatar] Offline
#6
Use timecolumn() inside your using spec. It parses the date and returns the corresponding Unix epoch seconds. That gives you the purely numeric representation of the timestamp that you need - and then it will be up to you to turn the Unix seconds into something meaningful again. The tm_ functions can help. (See table 8.6 on p176.)
carminat (49) [Avatar] Offline
#7
philipp.janert wrote:Use timecolumn() inside your using spec. It parses the date and returns the corresponding Unix epoch seconds. That gives you the purely numeric representation of the timestamp that you need - and then it will be up to you to turn the Unix seconds into something meaningful again. The tm_ functions can help. (See table 8.6 on p176.)


Thanks!
This sounds like the right thing to do; I will make some tries...