Histogram using gnuplot with multiple y-axes

回眸只為那壹抹淺笑 提交于 2019-12-05 20:19:24

Normally you can plot severyl histograms beneath each other using newhistogram. However, it seems like this is buggy when using patterns as fillstyle:

reset
set style histogram cluster gap 1
set style data histograms
set style fill pattern 1.00 border

set yrange [0:*]
set ytics nomirror
set y2range [0:*]
set y2tics

set key right autotitle columnheader
plot 'histplot.dat' u 2 every ::::0, '' u 3:xtic(1) every ::::0,\
     newhistogram lt 1 at 1,\
     'histplot.dat' u 2 every ::1::1 axes x1y2, '' u 3:xtic(1) every ::1::1 axes x1y2

Alternatively you can use multiplot and plot the two histograms directly beneath each other:

reset
set style histogram cluster gap 1
set style data histograms
set style fill pattern 1.00 border

set yrange [0:*]
set ytics nomirror
set multiplot layout 1,2
set rmargin at screen 0.5
set lmargin 9
unset key
plot 'histplot.dat' using 2 every ::::0 ti col, '' u 3:xticlabels(1) every ::::0 ti col

set rmargin 9
set lmargin at screen 0.5
unset ytics
set y2range [0:*]
set y2tics
set key right
plot '' using 2 every ::1::1 axes x1y2 ti col, '' u 3:xtic(1) every ::1::1 axes x1y2 ti col
unset multiplot

If you don't want the separating black line, you can use set border 7 for the first and set border 13 for the second plot.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!