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



908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
# File 'lib/numo/gnuplot.rb', line 908

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



925
926
927
928
929
930
931
# File 'lib/numo/gnuplot.rb', line 925

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