2017-05-30 129 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' 等... –