Class: CompareCompressors::Plotter

Inherits:
Object
  • Object
show all
Defined in:
lib/compare_compressors/plotter.rb

Overview

Plot compression results to gnuplot.

Direct Known Subclasses

CostPlotter, RawPlotter, SizePlotter

Constant Summary collapse

DEFAULT_TERMINAL =
'png size 640, 480'
DEFAULT_OUTPUT =
'compare_compressors.png'
DEFAULT_LOGSCALE_SIZE =
false
DEFAULT_AUTOSCALE_FIX =
false
DEFAULT_SHOW_LABELS =
true
DEFAULT_LMARGIN =
nil
DEFAULT_TITLE =
nil
DEFAULT_USE_CPU_TIME =
false

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(terminal:, output:, logscale_size:, autoscale_fix:, show_labels:, lmargin:, title:, use_cpu_time:) ⇒ Plotter

Returns a new instance of Plotter.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/compare_compressors/plotter.rb', line 17

def initialize(
  terminal:, output:, logscale_size:, autoscale_fix:,
  show_labels:, lmargin:, title:, use_cpu_time:
)
  @terminal = terminal
  @output = output
  @logscale_size = logscale_size
  @autoscale_fix = autoscale_fix
  @show_labels = show_labels
  @lmargin = lmargin
  @title = title
  @use_cpu_time = use_cpu_time

  @group_results = nil
  @io = nil
end

Instance Attribute Details

#autoscale_fixObject (readonly)

Returns the value of attribute autoscale_fix.



37
38
39
# File 'lib/compare_compressors/plotter.rb', line 37

def autoscale_fix
  @autoscale_fix
end

#group_resultsObject (readonly)

Returns the value of attribute group_results.



43
44
45
# File 'lib/compare_compressors/plotter.rb', line 43

def group_results
  @group_results
end

#ioObject (readonly)

Returns the value of attribute io.



44
45
46
# File 'lib/compare_compressors/plotter.rb', line 44

def io
  @io
end

#lmarginObject (readonly)

Returns the value of attribute lmargin.



39
40
41
# File 'lib/compare_compressors/plotter.rb', line 39

def lmargin
  @lmargin
end

#logscale_sizeObject (readonly)

Returns the value of attribute logscale_size.



36
37
38
# File 'lib/compare_compressors/plotter.rb', line 36

def logscale_size
  @logscale_size
end

#outputObject (readonly)

Returns the value of attribute output.



35
36
37
# File 'lib/compare_compressors/plotter.rb', line 35

def output
  @output
end

#show_labelsObject (readonly)

Returns the value of attribute show_labels.



38
39
40
# File 'lib/compare_compressors/plotter.rb', line 38

def show_labels
  @show_labels
end

#terminalObject (readonly)

Returns the value of attribute terminal.



34
35
36
# File 'lib/compare_compressors/plotter.rb', line 34

def terminal
  @terminal
end

#titleObject (readonly)

Returns the value of attribute title.



40
41
42
# File 'lib/compare_compressors/plotter.rb', line 40

def title
  @title
end

#use_cpu_timeObject (readonly)

Returns the value of attribute use_cpu_time.



41
42
43
# File 'lib/compare_compressors/plotter.rb', line 41

def use_cpu_time
  @use_cpu_time
end

Instance Method Details

#plot(group_results, pareto_only:, io: STDOUT) ⇒ Object



46
47
48
49
50
51
# File 'lib/compare_compressors/plotter.rb', line 46

def plot(group_results, pareto_only:, io: STDOUT)
  group_results = find_non_dominated(group_results) if pareto_only
  @group_results = group_results
  @io = io
  write
end