Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?J=c3=b6rg_Buchholz?= Newsgroups: comp.graphics.apps.gnuplot Subject: Re: Overlaying two histograms Date: Sat, 30 Jan 2016 10:01:21 +0100 Organization: A noiseless patient Spider Lines: 85 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 30 Jan 2016 08:58:32 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="f9d3022a8b5127644180de37a19ae9fb"; logging-data="12595"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Xh0zUJsQn49bQT/A0vTBKiYVAAz4LTGM=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0 SeaMonkey/2.39 In-Reply-To: Cancel-Lock: sha1:xJh29YHmeDBT1RArRF/2RMB6qKI= Xref: csiph.com comp.graphics.apps.gnuplot:3189 On 30.01.2016 09:04, Janis Papanagnou wrote: > On 30.01.2016 05:29, Janis Papanagnou wrote: >> [...] >>> But it is more "handcraftet" with boxes than use the histograms. >> >> [...], but I understand that I have to implement the layout >> myself in this case. > > With your example I've got an effective version. Though while I extended > your example I observed yet another alignment effect that I am puzzled > about. I am currently using this code: > > set output "hist-2.png" > ... > w = 0.07 > g = 0.12 > plot 'data' using 2:3:xtic(1) with boxes title columnheader lt 0,\ > '' using ($2-g):4:(w) with boxes title columnheader lt 17,\ > '' using ($2-2*g):6:(w) with boxes title columnheader lt 7,\ > '' using 2:7:(w) with boxes title columnheader lt 12,\ > '' using ($2+2*g):5:(w) with boxes title columnheader lt 4,\ > '' using ($2+g):8:(w) with boxes title columnheader lt 10 > > set output "hist-1.png" > plot 'data' using 2:3:xtic(1) with boxes title columnheader lt 0 > > Note that the output of the second plot command is a subset of the first. > But the layout of the respective boxes in the resulting *.png files do > not match, the scale is different; the boxes in hist-1 are more aligned > to the y/y2-axis while those of hist-2 are more compressed to the center. > (If my desciption is unclear, results can be seen in the links below.) > > My questions are; why are the additional 'using' commands affecting the > layout in this case, and how can that effect be avoided or worked around. > > Thanks for any hints and insights! I have in both plots the same result and layout. G N U P L O T Version 5.0 patchlevel 2 Debian 8 jp.dat: xtics x dd1 dd2 dd3 dd4 dd5 AAA 1 6.7 8.4 3.2 6.1 4.0 BBB 2 5.8 4.1 9.3 7.1 7.7 CCC 3 6.5 7.2 9.1 8.3 3.1 DDD 4 2.0 4.3 5.8 7.3 5.2 EEE 5 9.2 3.9 5.1 2.3 5.4 FFF 6 2.3 11.4 5.5 2.1 5.7 jp.plt: reset data = 'jp.dat' stats data u 2 rows=STATS_records stats data matrix cols=STATS_records/rows nor=rows-1 #number of rows to plot nodc=cols-2 #number of detail cols to plot bw= 0.8 #boxwidth bwd=(bw-0.1)/nodc #boxwidth details set boxwidth bw set style fill solid 1.0 noborder set xrange [0.5:nor+0.5] set yrange [0:int(STATS_max) + 1] plot data u 2:(($3+$4+$5+$6+$7)/nodc):xtic(1) with boxes title 'mean',\ '' u ($2-2*bwd):3:(bwd) with boxes title columnheader,\ '' u ($2-1*bwd):4:(bwd) with boxes title columnheader,\ '' u ($2+0*bwd):5:(bwd) with boxes title columnheader,\ '' u ($2+1*bwd):6:(bwd) with boxes title columnheader,\ '' u ($2+2*bwd):7:(bwd) with boxes title columnheader set term pngcairo set out 'jp1.png' replot set out set term qt 1 plot data u 2:(($3+$4+$5+$6+$7)/nodc):xtic(1) with boxes title 'mean' set out 'jp2.png' set term pngcairo replot set out set term qt Jörg