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


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

Re: Overlaying two histograms

From Jörg Buchholz <bookwood4new@freenet.de>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Overlaying two histograms
Date 2016-01-30 10:01 +0100
Organization A noiseless patient Spider
Message-ID <n8htvo$c9j$1@dont-email.me> (permalink)
References <n8afov$qpq$1@gioia.aioe.org> <n8avfv$es6$1@dont-email.me> <n8he6d$18ff$1@gioia.aioe.org> <n8hqqj$1moo$1@gioia.aioe.org>

Show all headers | View raw


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

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


Thread

Overlaying two histograms Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-01-27 14:13 +0100
  Re: Overlaying two histograms Jörg Buchholz <bookwood4news@freenet.de> - 2016-01-27 18:44 +0100
    Re: Overlaying two histograms Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-01-30 05:29 +0100
      Re: Overlaying two histograms Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-01-30 09:04 +0100
        Re: Overlaying two histograms Jörg Buchholz <bookwood4new@freenet.de> - 2016-01-30 10:01 +0100
          Re: Overlaying two histograms Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-01-30 12:31 +0100
            Re: Overlaying two histograms Jörg Buchholz <bookwood4news@freenet.de> - 2016-01-30 20:50 +0100
            Re: Overlaying two histograms Karl Ratzsch <mail.kfr@gmx.net> - 2016-01-31 20:07 +0100

csiph-web