3

2 つのヒストグラムを重ね合わせようとしていますが、2 つ目のヒストグラム (画像では青) を透明にして、その下のヒストグラムが見えるようにする必要があります。

ここに画像の説明を入力

これは私が使用しているコードです:

#!/bin/bash
gnuplot << EOF

set term postscript portrait color enhanced 
set output 'test.ps'
set size ratio 1
set multiplot
set size 0.5,0.5

n=20    #number of intervals
max=1.0 #max value
min=0.0    #min value
width=(max-min)/n        #interval width
hist(x,width)=width*floor(x/width)+width/2.0

set boxwidth width*0.9
set xrange [0:1]
plot "/path_to_file" u (hist(\$1,width)):(1.0) smooth freq w boxes lc rgb "black" lt 1 lw 0.5 notitle fs solid 0.5, \
"/path_to_file" u (hist(\$2,width)):(1.0) smooth freq w boxes  notitle fs transparent pattern 4 noborder lc rgb "blue" lt 1 lw 0.5

EOF

上記のコードで使用できるファイルは次のとおりです: http://pastebin.com/5qpFHgtZ

4

1 に答える 1

2

ターミナルをpng(またはpdfまたはpdfcairo)(例set term png enhanced)に変更すると、正しいように見えるプロットが得られます。

ただし、gnuplotはpostscript、透明なプロットを作成する必要があると考えているようです(以下の表を参照してくださいhelp transparent)。だから、私の診断は、それがgnuplotのバグか、ドキュメントのバグのどちらかであるということです。

   terminal   solid pattern    pm3d
   --------------------------------
   gif           no     yes      no
   jpeg         yes      no     yes
   pdf          yes     yes     yes
   png    TrueColor   index     yes
   post          no     yes      no
   svg          yes      no     yes
   win          yes     yes     yes
   wxt          yes     yes     yes
   x11           no     yes      no
于 2012-09-12T14:40:26.837 に答える