2017-07-14 40 views
1

我想繪製兩個數據系列繪製在一個圖形(直方圖)使用gnuplot。一個是基線數據,另一個是優化的。該腳本目前看起來像這樣。直方圖使用gnuplot在同一圖形中的多個數據

n=50 
    max=0.07946462 
    min=0.0 
    reset 
    width=(max-min)/n #interval width 
    hist(x,width)=width*floor(x/width)+width/2.0 #function used to map a value 
    to the intervals 
    set term png #output terminal and file 
    set output "histogram.png" 
    set xrange [min:max] 
    set yrange [0:] 
    set style fill solid 0.5 #fillstyle 
    set termopt enhanced # turn on enhanced text mode 
    set xlabel "PowerDensity(mA/um2)" 
    set ylabel "Area(um2)" 
    set title 'Power Density Histogram' 
    plot 'power_density_oxili_sptp.txt' u (hist($2,width)):($1) smooth frequency 
    w boxes lc rgb"blue" title 'Baseline', 'power_density_oxili_sptp.txt' u 
    (hist($3,width)):($1) smooth frequency w boxes lc rgb"red" title 'Optimized' 

這樣做的輸出將給出

enter image description here

這裏的問題,我無法看到基線數據(藍色)完全,因爲它是隱藏優化的數據如下。要麼我需要看到兩個數據,要麼我需要在同一個圖中分別繪製直方圖。 Br Sree

回答

0

它看起來像你想要兩個直方圖是透明的。對於您應該設置在你的填充樣式的transparent標誌(見help fillstyple):

set style fill transparent solid 0.5 

此外,還需要指定truecolor從標準PNG終端得到透明區域(見help png):

set term png truecolor 

或者,您可以使用pngcairo終端。