Class: Numo::Gnuplot::SPlotArray
- Defined in:
- lib/numo/gnuplot.rb
Instance Method Summary collapse
- #cmd_str ⇒ Object
- #data_str ⇒ Object
-
#initialize(data) ⇒ SPlotArray
constructor
:nodoc: all.
Methods inherited from PlotData
Constructor Details
#initialize(data) ⇒ SPlotArray
:nodoc: all
565 566 567 |
# File 'lib/numo/gnuplot.rb', line 565 def initialize(data) @data = data end |
Instance Method Details
#cmd_str ⇒ Object
569 570 571 572 573 574 575 576 |
# File 'lib/numo/gnuplot.rb', line 569 def cmd_str if @text "'-' matrix" else s = @data.shape "'-' binary array=(#{s[1]},#{s[0]}) format='%float64'" end end |
#data_str ⇒ Object
578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
# File 'lib/numo/gnuplot.rb', line 578 def data_str if @text f = data_format s = "" a.each do |b| s << b.map{|e| f%e}.join(" ")+"\n" end s+"\ne" elsif defined? Numo::NArray Numo::DFloat.cast(@data).to_string else @data.to_a.flatten.pack("d*") end end |