Гнуплот частично уложенные бары - PullRequest
0 голосов
/ 25 января 2019

Я хотел бы сделать график gnuplot с одним полным столбцом и другим с накоплением.Данные выглядят примерно так:

x   data    E   M   L
[10,20) 0.000000    1.081916    2.0958133   5.473606
[20,40) 0.000000    2.331769    2.1402838   4.528341
[40,80) 3.262375    2.201788    1.3499280   3.023847
>80 2.368121    2.132216    0.7322889   2.610368

, где E, M и L - три "зеленых" компонента.

Я пытался сделать что-то вроде

set style data histograms
set style histogram rowstacked
#set style histogram cluster gap 1
set style fill solid
...

plot newhistogram, "size_class_data/tree_paracou.txt" using 2:xticlabel(1) linecolor rgb data_color title "Model",\
newhistogram, '' using 3:xticlabel(1) linecolor rgb early_color title "d",\
'' using 4 linecolor rgb mid_color title "g",\
'' using 5 linecolor rgb late_color title "f"

но эти два графика лежат на двух разных частях оси х.enter image description here

1 Ответ

0 голосов
/ 25 января 2019

Команда newhistogram имеет опцию at для установки координаты первого поля.

В вашем случае вы можете зафиксировать ширину коробки и начать вторую гистограмму с 0 + ширина поля:

set style data histograms
set style histogram rowstacked
set style fill solid
set boxwidth 0.33 absolute

plot "foo.dat" using 2:xticlabel(1) skip 1 linecolor rgb "black"  title "Model",\
newhistogram at 0.33, '' using 3 skip 1 linecolor rgb "red" title "d",\
'' using 4 skip 1 linecolor rgb "green" title "g",\
'' using 5 skip 1 linecolor rgb "blue" title "f"

enter image description here

...