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
array_shape, #data_format, #line_str
Constructor Details
#initialize(data) ⇒ SPlotArray
:nodoc: all
870 871 872 |
# File 'lib/numo/gnuplot.rb', line 870 def initialize(data) @data = data end |
Instance Method Details
#cmd_str ⇒ Object
874 875 876 877 878 879 880 881 |
# File 'lib/numo/gnuplot.rb', line 874 def cmd_str if @text "'-' matrix" else s = @data.shape "'-' binary array=(#{s[1]},#{s[0]}) format='%float64'" end end |
#data_str ⇒ Object
883 884 885 886 887 888 889 890 891 892 893 894 895 896 |
# File 'lib/numo/gnuplot.rb', line 883 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 |