Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #3262

Re: Histograms series overlap

From Joe <joe@invalid.invalid>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Histograms series overlap
Date 2016-03-16 17:52 +0000
Organization Aioe.org NNTP Server
Message-ID <ncc6gf$1lee$1@gioia.aioe.org> (permalink)
References <ncbtlu$14fm$1@gioia.aioe.org> <dktec3F1762U1@mid.dfncis.de>

Show all headers | View raw


Hans-Bernhard Bröker <HBBroeker@t-online.de> wrote:
> 
> I'm afraid combining data from two sets like that is going to be 
> impossible with the data residing in two separate input files.  With the 
> data in a 3-column file, something like
> 
> plot 'file.dat' u 1:(max($2,$3)):(1+($2>$3)) w boxes lc var, \
>              '' u 1:(min($2,$3)):(1+($3>=$2)) w boxes lc var
> 
> might do it.
> 
> I therefore suggest you use external tools like the classic Unix 
> utilities 'join' and 'paste' to turn your two files into one, before 
> attempting to plot this.
> 
>> Can I obtain a plot like I've explained above?
> 
> Let's just say that putting the two data sets besides each other (i.e. 
> using slimmer boxes, with a bit of horizontal displacement) would be a 
> whole lot easier than trying to force gnuplot to do it your way.

I've just tried a script like follows:

---------------------------
min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y
set xtics 3600*8 rotate by 80 right
set xdata time
set timefmt "%d/%m/%Y %H:%M"
set format x "%d/%m/%Y - %H:%M"
set yrange [-1:35]
set ytics 5 out
plot 'data.tmp' u 1:(max($3,$4)):(1+($3>$4)) w boxes lc var, \
              '' u 1:(min($3,$4)):(1+($4>=$3)) w boxes lc var
---------------------------------------------------------------

$ cat data.tmp 
--------------------------------------
16/01/2015 10:00         0.00    0.40
16/01/2015 11:00         0.00    0.00
16/01/2015 12:00         0.20    2.40
16/01/2015 13:00         0.80    5.80
16/01/2015 14:00         0.80    2.60
16/01/2015 15:00         0.00    0.00
16/01/2015 16:00         0.20    1.00
16/01/2015 17:00         0.20    0.20
16/01/2015 18:00         1.80    1.00
16/01/2015 19:00         2.20    2.20
16/01/2015 20:00         19.60   6.60
16/01/2015 21:00         20.00   9.20
16/01/2015 22:00         11.60   21.20
16/01/2015 23:00         8.80    6.20
17/01/2015 00:00         5.20    2.20
17/01/2015 01:00         0.40    0.80
17/01/2015 02:00         0.00    0.20
17/01/2015 03:00         0.00    0.00
17/01/2015 04:00         0.00    0.00
17/01/2015 05:00         0.00    0.00
17/01/2015 06:00         0.00    0.00
17/01/2015 07:00         0.00    0.00
17/01/2015 08:00         0.00    0.00
17/01/2015 09:00         0.00    0.00
--------------------------------------

data.tmp is created by using sed, cut, paste... as you suggested.
Output plot is exactly what I was looking for.

Thanks a lot for your reply.

I have to plot many data: hourly measurements of about one or more
years. So 10000 or more data.
Moreover I often have to consider more than just two measurement
stations, let's say 3 or 4 stations.
For this reason, I don't have much horizontal space to put 3 or 4
boxes for one single "datetime" tic.

How can I adjust your plot command to work with more than two
stations?
We will have a data.tmp file with values on column 2nd, 3rd, 4th,
5th, 6th...

Thanks again!

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Find similar


Thread

Histograms series overlap Joe <joe@invalid.invalid> - 2016-03-16 15:21 +0000
  Re: Histograms series overlap Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2016-03-16 17:02 +0100
    Re: Histograms series overlap Joe <joe@invalid.invalid> - 2016-03-16 17:52 +0000

csiph-web