Class: Numo::Gnuplot::SPlotRecord

Inherits:
PlotData
  • Object
show all
Defined in:
lib/numo/gnuplot.rb

Instance Method Summary collapse

Methods inherited from PlotData

array_shape, #data_format, #data_str, #line_str

Constructor Details

#initialize(x, y, z) ⇒ SPlotRecord

:nodoc: all



842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
# File 'lib/numo/gnuplot.rb', line 842

def initialize(x,y,z)
  @text = false
  @data = [x,y,z].map{|a| a.flatten}
  @n = @data.map{|a| a.size}.min
  shape = PlotData.array_shape(z)
  if shape.size >= 2
    n = shape[1]*shape[0]
    if @n < n
      kernel_raise GnuplotError, "data size mismatch"
    end
    @n = n
    @record = "#{shape[1]},#{shape[0]}"
  else
    @record = "#{@n}"
  end
end

Instance Method Details

#cmd_strObject



859
860
861
862
863
864
865
# File 'lib/numo/gnuplot.rb', line 859

def cmd_str
  if @text
    "'-'"
  else
    "'-' binary record=(#{@record}) format='%float64' using 1:2:3"
  end
end