2011年6月16日

[心得]gnuplot in action -- chapter 5

這一張主要是介紹各種plot style,也就是各種類似bar chart, line chart ...等等的
所以直接看指令跟看圖說話會比較快
plot data with [style]
plot function with [style]


分別是with points, with lines, with linepoints, with dots,這裡重要的參數是pointsize,調整point size的大小


分別是三種style: histeps, steps, fsteps,適用於一些類似six sigama的圖形,注意資料點的位置



style boxes,用來模擬bar chart,相同x位置的資料會重複在同一個x座標,要把他錯開可以參考我之前寫的例子,重要的參數如下
set boxwidth [ {flt:size} ] [ absolute | relative ]
set style fill [ empty | solid [{flt:density}] | pattern [{idx:n}] ] [ border [ {idx:linetype} ] | noborder ]


4.x之後才加進來的,更類似bar chart
set style fill pattern
set style histogram clustered
set style data histograms
plot "histo" u 2 t "Red", "" u 3 t "Green", "" u 4 t "Blue"


另外有errorbars的style,分別如上描述

line style的指令是至為重要的,如果你打算在不同的terminal之間作切換,千萬別忘記設定這個部份,最好不要使用預設值,不然在切換的時候會有出乎你意料之外的樣式出來,即使設定了line style在顏色跟樣式也可能會有出入,但是至少可以縮小
set style line {int:index} [ [ linetype | lt ] {idx:linetype} ]
[ [ linewidth | lw ] {flt:linewidth} ]
[ [ pointtype | pt ] {idx:pointtype} ]
[ [ pointsize | ps ] {flt:pointsize} ]
[ [ linecolor | lc ] {clr:colorspec} ]
使用語法如上,就是給定一個index接著設定後面的linetype, linewidth, pointtype, pointsize, linecolor等等參數
gnuplot v4.4 在wxt底下,linetype預設不會遞增,可是如果切換到postscript則會遞增,也就是說wxt下線條預設為solid line,但是postscript可能會是solid line, dash line ...。相反的,在wxt顏色會自動定增,但是postscript卻不會。即使設定的color在eps跟postscript顏色又有些不同,不過至少可以透過調色盤來改變
我後面的文章"gnuplot的小陷阱"有圖示的範例
還有蠻多的內容,有空再補齊

沒有留言: