2014-04-15 30 views
1

x,y數據集的默認繪圖符號是紅色十字。假設我希望它是一個充滿黑色的方塊。我怎麼做?如何在gnuplot的ruby實現中指定劇情符號?

爲了使我在這個代碼示例中做的事情透明,我在(已經指定的)輸出路徑上使用gnuplot設置了一個圖。這是一個PNG,具有指定的大小,字體和字體大小。我用左邊距和邊框厚度擺弄一下,給我的斧頭一些標題,但那些是其他美學。

要生成黑線,我會取消註釋該註釋行。但是,我如何得到填充的正方形?在http://gnuplot.sourceforge.net/docs_4.6/gnuplot.pdf

::Gnuplot.open do |gp| 
    ::Gnuplot::Plot.new(gp) do |plot| 
     plot.terminal "png size 1800,600 font \"arial,20\"" 
     plot.lmargin "10" 
     plot.output "#{star[:wrapped_rv_plot]}" 
     plot.border "linewidth 2" 
     plot.ylabel "Radial velocity (km/s)" 
     plot.xlabel "Orbital Phase" 

     x = ext_phase_rv.map { |point| point[0] } 
     y = ext_phase_rv.map { |point| point[1] } 

     plot.data << ::Gnuplot::DataSet.new([x, y]) do |ds| 
     # ds.with = "lines lt rgb \"black\"" 
     ds.notitle 
     end 
    end 
    end 

回答

1

我不能從gnuplot的文檔,做出來你得到平方百分點linetype 5,例如見Gnuplot line types。要點積分,請使用with points :)

ds.with = "points" 
ds.linecolor = "rgb 'blue' linetype 5" 
+0

這並沒有完全做到這一點,但它讓我走上了正確的軌道。特別是參考測試頁面。謝謝! – sjmurphy

+1

對我來說,它工作正常,當然我會在回答之前對它進行測試!當前版本的[ruby gnuplot gem](https://github.com/rdp/ruby_gnuplot/blob/master/lib/gnuplot.rb)甚至允許您使用'ds.linestyle'並定義適當的線條樣式。 – Christoph

0

用下面的代碼替換註釋行會產生黑色方塊。請參閱Christoph的回答,以獲得更多'pt'(點類型)示例的鏈接。

ds.with = "points lc rgb 'black' pt 5"