Path: csiph.com!aioe.org!.POSTED!not-for-mail From: Joe Newsgroups: comp.graphics.apps.gnuplot Subject: Re: Histograms series overlap Date: Wed, 16 Mar 2016 17:52:15 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 82 Message-ID: References: NNTP-Posting-Host: ZOONrPMyRlF6fthsr5zmzg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.graphics.apps.gnuplot:3262 Hans-Bernhard Bröker 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!