2017-05-30 125 views
0

我要創建這個直方圖的gnuplot: samplegnuplot的:顏色堆積柱狀圖

我使用http://gnuplot.sourceforge.net/demo/histograms.html

數據文件中的第6例有一個結構:

地區奧地利匈牙利...

1891-1900 234081 181288 ...

1901-1910 668209 808511 ...

...

https://github.com/gnuplot/gnuplot/blob/master/demo/immigration.dat

最小劇本我已經在這裏 http://gnuplot.sourceforge.net/demo/histograms.6.gnu

了是否可以設置自定義顏色期間?

回答

1

也許不是最完美的解決方案,但人們可以通過手動覆蓋默認線型規定的顏色:

set lt 1 lc rgb 'red' 
set lt 2 lc rgb 'orange-red' 
set lt 3 lc rgb 'orange' 
set lt 4 lc rgb 'yellow' 
set lt 5 lc rgb 'green' 
set lt 6 lc rgb 'blue' 
set lt 7 lc rgb 'dark-blue' 
set lt 8 lc rgb 'violet' 

plot 'immigration.dat' using 6 ti col, '' using 12 ti col, '' using 13 ti col, '' using 14:key(1) ti col 

配搭您最少的腳本,這將產生: enter image description here

+0

感謝您回答! 但是有可能在數據文件中有顏色值嗎?再次 –

+0

謝謝,我發現了傳遞變量的解決方法,我的劇本,您的解決方案: 'gnuplot的-e 「顏色1 = XXX」 my_script' 內的MyScript: '設置LT 1 LC RGB color1' 等... –