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


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

Re: Overlaying two histograms

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

Show all headers | View raw


On 27.01.2016 14:13, Janis Papanagnou wrote:
> This is probably not that easy to answer; I'll try to explain my problem.
>
> In case that the ASCII-art below is not displayed appropriately I've added
> two links to the respective *.png files in the signature for clarification.
>
> I have currently two histogram data; the first are plain boxes like this:
>
>   |        _              |
>   |  _    | |             |
>   | | |   | |    _        |
>   | | |   | |   | |       |
>   +-----+-----+-----+ ... +
>     AAA   BBB   CCC
>
> and I use code like this to create it:
>
>    set boxwidth 0.67 relative
>    set style fill solid 1.0
>    ...
>    plot 'data-1' using 2:xticlabels(1) title '' with boxes lt 0
>
> This is exactly what I want for the first visible layer (at the bottom).
> Now I want to put data with a more detailled resulution on top. Each of
> the boxes above will be overlayed by a couple thin boxes. To create the
> respective second histogram layer I use code like this to create it:
>
>    set style data histograms
>    ...
>    set boxwidth 0.67 relative
>    set style fill solid 1.0
>    ...
>    plot 'data-2' using 3:xtic(1) ti col, '' using 5 ti col, \
>         '' using 6 ti col, '' using 4 ti col, '' using 7 ti col
>
> This is not exactly what I want; as opposed to the first layer above the
> respective clusters of the histogram are grouped around the '+' tic-marks,
> like this:
>
>   |    |                  |
>   |    ||      |    |     |
>   |    ||    | |    ||    |
>   |    |||   |||   |||    |
>   +-----+-----+-----+ ... +
>        AAA   BBB   CCC
>
> What I need to overlay the first histogram with the second one would be
> something like this instead:
>
>   | |                     |
>   | ||      |    |        |
>   | ||    | |    ||       |
>   | |||   |||   |||       |
>   +-----+-----+-----+ ... +
>     AAA   BBB   CCC
>
> but it seems that the definition of "set style data histograms" results in
> that formatting, grouped around the tic-marks. Can this default be changed?
>
> The question is; how can I specify such clustered histogram data to be
> aligned appropriately? - A solution to this question is the precondition to
> overlay the two data representations so that the respective boxes and the
> x-tic labels match.
>

If I understand your problem correctly this small example may can help 
you. But it is more "handcraftet" with boxes than use the histograms.

File jp.dat:
xtics	x	data	dd1	dd2	dd3
AAA	1	7	6	8	3
BBB	2	6	5	4	9
CCC	3	8	6	7	9

gnuplot-script:
set boxwidth 0.8
set style fill solid 1.0
set xrange [0:4]
set yrange [0:10]
plot 'jp.dat' u 2:3:xtic(1) with boxes title columnheader,\
'' u ($2-0.3):4:(0.2) with boxes title columnheader,\
'' u 2:5:(0.2) with boxes title columnheader,\
'' u ($2+0.3):6:(0.2) with boxes title columnheader

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