From 697e01d49ec5dcce3bf356ba6d2efbf16db5fe62 Mon Sep 17 00:00:00 2001 From: kojix2 Date: Thu, 24 Mar 2022 09:50:44 +0000 Subject: [PATCH] deploy: 523700348cc347b07fc6009d39daf68b691f118d --- .nojekyll | 0 UnicodePlot.html | 251 +++ YouPlot.html | 306 ++++ YouPlot/Backends.html | 128 ++ YouPlot/Backends/Processing.html | 218 +++ YouPlot/Backends/UnicodePlot.html | 1080 +++++++++++++ YouPlot/Backends/UnicodePlot/Error.html | 124 ++ YouPlot/Command.html | 765 +++++++++ YouPlot/DSV.html | 470 ++++++ YouPlot/Data.html | 310 ++++ YouPlot/Options.html | 1113 +++++++++++++ YouPlot/Parameters.html | 1891 +++++++++++++++++++++++ YouPlot/Parser.html | 1710 ++++++++++++++++++++ YouPlot/Parser/Error.html | 124 ++ _index.html | 248 +++ class_list.html | 51 + css/common.css | 1 + css/full_list.css | 58 + css/style.css | 497 ++++++ file.README.html | 410 +++++ file_list.html | 56 + frames.html | 17 + index.html | 410 +++++ js/app.js | 314 ++++ js/full_list.js | 216 +++ js/jquery.js | 4 + method_list.html | 699 +++++++++ top-level-namespace.html | 110 ++ 28 files changed, 11581 insertions(+) create mode 100644 .nojekyll create mode 100644 UnicodePlot.html create mode 100644 YouPlot.html create mode 100644 YouPlot/Backends.html create mode 100644 YouPlot/Backends/Processing.html create mode 100644 YouPlot/Backends/UnicodePlot.html create mode 100644 YouPlot/Backends/UnicodePlot/Error.html create mode 100644 YouPlot/Command.html create mode 100644 YouPlot/DSV.html create mode 100644 YouPlot/Data.html create mode 100644 YouPlot/Options.html create mode 100644 YouPlot/Parameters.html create mode 100644 YouPlot/Parser.html create mode 100644 YouPlot/Parser/Error.html create mode 100644 _index.html create mode 100644 class_list.html create mode 100644 css/common.css create mode 100644 css/full_list.css create mode 100644 css/style.css create mode 100644 file.README.html create mode 100644 file_list.html create mode 100644 frames.html create mode 100644 index.html create mode 100644 js/app.js create mode 100644 js/full_list.js create mode 100644 js/jquery.js create mode 100644 method_list.html create mode 100644 top-level-namespace.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/UnicodePlot.html b/UnicodePlot.html new file mode 100644 index 0000000..5104ea2 --- /dev/null +++ b/UnicodePlot.html @@ -0,0 +1,251 @@ + + + + + + + Module: UnicodePlot + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: UnicodePlot + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/backends/unicode_plot.rb
+
+ +
+ +

Overview

+
+ +

If the line color is specified as a number, the program will display an error message to the user and exit. Remove this patch when UnicodePlot is improved.

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .lineplot(*args, **kw) ⇒ Object + + + + + +

+ + + + +
+
+
+
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 15
+
+def lineplot(*args, **kw)
+  if kw[:color].is_a? Numeric
+    warn <<~EOS
+      YouPlot: Line colors cannot be specified by numerical values.
+
+      For more information, please see the following issue.
+      https://github.com/red-data-tools/unicode_plot.rb/issues/34
+    EOS
+    YouPlot.run_as_executable ? exit(1) : raise(Error)
+  end
+  lineplot_original(*args, **kw)
+end
+
+
+ +
+

+ + .lineplot_originalObject + + + + + +

+ + + + +
+
+
+
+14
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 14
+
+alias lineplot_original lineplot
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot.html b/YouPlot.html new file mode 100644 index 0000000..5420962 --- /dev/null +++ b/YouPlot.html @@ -0,0 +1,306 @@ + + + + + + + Module: YouPlot + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: YouPlot + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot.rb,
+ lib/youplot/dsv.rb,
lib/youplot/parser.rb,
lib/youplot/command.rb,
lib/youplot/options.rb,
lib/youplot/version.rb,
lib/youplot/parameters.rb,
lib/youplot/backends/processing.rb,
lib/youplot/backends/unicode_plot.rb
+
+
+ +
+ +

Defined Under Namespace

+

+ + + Modules: Backends, DSV + + + + Classes: Command, Data, Options, Parameters, Parser + + +

+ + +

+ Constant Summary + collapse +

+ +
+ +
VERSION = + +
+
'0.4.3'
+ +
+ + + + + +

Class Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + + + +
+

Class Attribute Details

+ + + +
+

+ + .run_as_executableObject + + + + + +

+
+ +

Returns the value of attribute run_as_executable.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/youplot.rb', line 16
+
+def run_as_executable
+  @run_as_executable
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .run_as_executable?Boolean + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+18
+19
+20
+
+
# File 'lib/youplot.rb', line 18
+
+def run_as_executable?
+  @run_as_executable
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot/Backends.html b/YouPlot/Backends.html new file mode 100644 index 0000000..a568e2b --- /dev/null +++ b/YouPlot/Backends.html @@ -0,0 +1,128 @@ + + + + + + + Module: YouPlot::Backends + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: YouPlot::Backends + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/backends/processing.rb,
+ lib/youplot/backends/unicode_plot.rb
+
+
+ +
+ +

Overview

+
+ +

plotting functions.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Processing, UnicodePlot + + + + +

+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot/Backends/Processing.html b/YouPlot/Backends/Processing.html new file mode 100644 index 0000000..bc86463 --- /dev/null +++ b/YouPlot/Backends/Processing.html @@ -0,0 +1,218 @@ + + + + + + + Module: YouPlot::Backends::Processing + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: YouPlot::Backends::Processing + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/backends/processing.rb
+
+ +
+ + + + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .count_values(arr, tally: true, reverse: false) ⇒ Object + + + + + +

+ + + + +
+
+
+
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+
+
# File 'lib/youplot/backends/processing.rb', line 9
+
+def count_values(arr, tally: true, reverse: false)
+  # tally was added in Ruby 2.7
+  result = \
+    if tally && Enumerable.method_defined?(:tally)
+      arr.tally
+    else
+      # value_counts Enumerable::Statistics
+      arr.value_counts(dropna: false)
+    end
+
+  # sorting
+  result = result.sort do |a, b|
+    # compare values
+    r = b[1] <=> a[1]
+    # If the values are the same, compare by name
+    r = a[0] <=> b[0] if r.zero?
+    r
+  end
+
+  # --reverse option
+  result.reverse! if reverse
+
+  # prepare for barplot
+  result.transpose
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot/Backends/UnicodePlot.html b/YouPlot/Backends/UnicodePlot.html new file mode 100644 index 0000000..93a983f --- /dev/null +++ b/YouPlot/Backends/UnicodePlot.html @@ -0,0 +1,1080 @@ + + + + + + + Module: YouPlot::Backends::UnicodePlot + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: YouPlot::Backends::UnicodePlot + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/backends/unicode_plot.rb
+
+ +
+ +

Defined Under Namespace

+

+ + + + + Classes: Error + + +

+ + + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .barplot(data, params, fmt = nil, count: false, reverse: false) ⇒ Object + + + + + +

+ + + + +
+
+
+
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 38
+
+def barplot(data, params, fmt = nil, count: false, reverse: false)
+  headers = data.headers
+  series = data.series
+  # `uplot count`
+  if count
+    series = Processing.count_values(series[0], reverse: reverse)
+    params.title = headers[0] if headers
+  end
+  if series.size == 1
+    # If there is only one series.use the line number for label.
+    params.title ||= headers[0] if headers
+    labels = Array.new(series[0].size) { |i| (i + 1).to_s }
+    values = series[0].map(&:to_f)
+  else
+    # If there are 2 or more series...
+    if fmt == 'yx'
+      # assume that the first 2 series are the y and x series respectively.
+      x_col = 1
+      y_col = 0
+    else
+      # assume that the first 2 series are the x and y series respectively.
+      x_col = 0
+      y_col = 1
+    end
+    params.title ||= headers[y_col] if headers
+    labels = series[x_col]
+    values = series[y_col].map(&:to_f)
+  end
+  ::UnicodePlot.barplot(labels, values, **params.to_hc)
+end
+
+
+ +
+

+ + .boxplot(data, params) ⇒ Object + + + + + +

+ + + + +
+
+
+
+173
+174
+175
+176
+177
+178
+179
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 173
+
+def boxplot(data, params)
+  headers = data.headers
+  series = data.series
+  headers ||= (1..series.size).map(&:to_s)
+  series.map! { |s| s.map(&:to_f) }
+  ::UnicodePlot.boxplot(headers, series, **params.to_hc)
+end
+
+
+ +
+

+ + .check_series_size(data, fmt) ⇒ Object + + + + + +

+ + + + +
+
+
+
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 201
+
+def check_series_size(data, fmt)
+  series = data.series
+  if series.size == 1
+    warn <<~EOS
+      YouPlot: There is only one series of input data. Please check the delimiter.
+
+      Headers: \e[35m#{data.headers.inspect}\e[0m
+      The first item is: \e[35m\"#{series[0][0]}\"\e[0m
+      The last item is : \e[35m\"#{series[0][-1]}\"\e[0m
+    EOS
+    # NOTE: Error messages cannot be colored.
+    YouPlot.run_as_executable ? exit(1) : raise(Error)
+  end
+  if fmt == 'xyxy' && series.size.odd?
+    warn <<~EOS
+      YouPlot: In the xyxy format, the number of series must be even.
+
+      Number of series: \e[35m#{series.size}\e[0m
+      Headers: \e[35m#{data.headers.inspect}\e[0m
+    EOS
+    # NOTE: Error messages cannot be colored.
+    YouPlot.run_as_executable ? exit(1) : raise(Error)
+  end
+end
+
+
+ +
+

+ + .colors(color_names = false) ⇒ Object + + + + + +

+ + + + +
+
+
+
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 181
+
+def colors(color_names = false)
+  # FIXME
+  s = String.new
+  ::UnicodePlot::StyledPrinter::TEXT_COLORS.each do |k, v|
+    s << v
+    s << k.to_s
+    unless color_names
+      s << "\t"
+      s << ''
+    end
+    s << "\033[0m"
+    s << "\t"
+  end
+  s << "\n"
+  def s.render(obj)
+    obj.print(self)
+  end
+  s
+end
+
+
+ +
+

+ + .density(data, params, fmt = 'xyy') ⇒ Object + + + + + +

+ + + + +
+
+
+
+168
+169
+170
+171
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 168
+
+def density(data, params, fmt = 'xyy')
+  check_series_size(data, fmt)
+  plot_fmt(data, fmt, :densityplot, params)
+end
+
+
+ +
+

+ + .get_method2(method1) ⇒ Object + + + + + +

+ + + + +
+
+
+
+106
+107
+108
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 106
+
+def get_method2(method1)
+  "#{method1}!".to_sym
+end
+
+
+ +
+

+ + .histogram(data, params) ⇒ Object + + + + + +

+ + + + +
+
+
+
+69
+70
+71
+72
+73
+74
+75
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 69
+
+def histogram(data, params)
+  headers = data.headers
+  series = data.series
+  params.title ||= data.headers[0] if headers
+  values = series[0].map(&:to_f)
+  ::UnicodePlot.histogram(values, **params.to_hc)
+end
+
+
+ +
+

+ + .line(data, params, fmt = nil) ⇒ Object + + + + + +

+ + + + +
+
+
+
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 77
+
+def line(data, params, fmt = nil)
+  headers = data.headers
+  series = data.series
+  if series.size == 1
+    # If there is only one series, it is assumed to be sequential data.
+    params.ylabel ||= headers[0] if headers
+    y = series[0].map(&:to_f)
+    ::UnicodePlot.lineplot(y, **params.to_hc)
+  else
+    # If there are 2 or more series...
+    if fmt == 'yx'
+      # assume that the first 2 series are the y and x series respectively.
+      x_col = 1
+      y_col = 0
+    else
+      # assume that the first 2 series are the x and y series respectively.
+      x_col = 0
+      y_col = 1
+    end
+    if headers
+      params.xlabel ||= headers[x_col]
+      params.ylabel ||= headers[y_col]
+    end
+    x = series[x_col].map(&:to_f)
+    y = series[y_col].map(&:to_f)
+    ::UnicodePlot.lineplot(x, y, **params.to_hc)
+  end
+end
+
+
+ +
+

+ + .lines(data, params, fmt = 'xyy') ⇒ Object + + + + + +

+ + + + +
+
+
+
+158
+159
+160
+161
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 158
+
+def lines(data, params, fmt = 'xyy')
+  check_series_size(data, fmt)
+  plot_fmt(data, fmt, :lineplot, params)
+end
+
+
+ +
+

+ + .plot_fmt(data, fmt, method1, params) ⇒ Object + + + + + +

+ + + + +
+
+
+
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 145
+
+def plot_fmt(data, fmt, method1, params)
+  case fmt
+  when 'xyy'
+    plot_xyy(data, method1, params)
+  when 'xyxy'
+    plot_xyxy(data, method1, params)
+  when 'yx'
+    raise "Incorrect format: #{fmt}"
+  else
+    raise "Unknown format: #{fmt}"
+  end
+end
+
+
+ +
+

+ + .plot_xyxy(data, method1, params) ⇒ Object + + + + + +

+ + + + +
+
+
+
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 128
+
+def plot_xyxy(data, method1, params)
+  headers = data.headers
+  series2 = data.series
+                .map { |s| s.map(&:to_f) }
+                .each_slice(2).to_a
+  method2 = get_method2(method1)
+  params.name ||= headers[0] if headers
+  params.xlim ||= series2.map(&:first).flatten.minmax # why need?
+  params.ylim ||= series2.map(&:last).flatten.minmax # why need?
+  x1, y1 = series2.shift
+  plot = ::UnicodePlot.public_send(method1, x1, y1, **params.to_hc)
+  series2.each_with_index do |(xi, yi), i|
+    ::UnicodePlot.public_send(method2, plot, xi, yi, name: headers&.[]((i + 1) * 2))
+  end
+  plot
+end
+
+
+ +
+

+ + .plot_xyy(data, method1, params) ⇒ Object + + + + + +

+ + + + +
+
+
+
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 110
+
+def plot_xyy(data, method1, params)
+  headers = data.headers
+  series = data.series
+  method2 = get_method2(method1)
+  series.map! { |s| s.map(&:to_f) }
+  if headers
+    params.name   ||= headers[1]
+    params.xlabel ||= headers[0]
+  end
+  params.xlim ||= series[0].flatten.minmax # why need?
+  params.ylim ||= series[1..-1].flatten.minmax # why need?
+  plot = ::UnicodePlot.public_send(method1, series[0], series[1], **params.to_hc)
+  2.upto(series.size - 1) do |i|
+    ::UnicodePlot.public_send(method2, plot, series[0], series[i], name: headers&.[](i))
+  end
+  plot
+end
+
+
+ +
+

+ + .scatter(data, params, fmt = 'xyy') ⇒ Object + + + + + +

+ + + + +
+
+
+
+163
+164
+165
+166
+
+
# File 'lib/youplot/backends/unicode_plot.rb', line 163
+
+def scatter(data, params, fmt = 'xyy')
+  check_series_size(data, fmt)
+  plot_fmt(data, fmt, :scatterplot, params)
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot/Backends/UnicodePlot/Error.html b/YouPlot/Backends/UnicodePlot/Error.html new file mode 100644 index 0000000..c02aec3 --- /dev/null +++ b/YouPlot/Backends/UnicodePlot/Error.html @@ -0,0 +1,124 @@ + + + + + + + Exception: YouPlot::Backends::UnicodePlot::Error + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Exception: YouPlot::Backends::UnicodePlot::Error + + + +

+
+ +
+
Inherits:
+
+ StandardError + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/backends/unicode_plot.rb
+
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot/Command.html b/YouPlot/Command.html new file mode 100644 index 0000000..5029c25 --- /dev/null +++ b/YouPlot/Command.html @@ -0,0 +1,765 @@ + + + + + + + Class: YouPlot::Command + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: YouPlot::Command + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/command.rb
+
+ +
+ + + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #command ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute command.

    +
    + +
  • + + +
  • + + + #data ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
    +

    Returns the value of attribute data.

    +
    + +
  • + + +
  • + + + #options ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute options.

    +
    + +
  • + + +
  • + + + #params ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute params.

    +
    + +
  • + + +
  • + + + #parser ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
    +

    Returns the value of attribute parser.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ + + + +
+

Constructor Details

+ +
+

+ + #initialize(argv = ARGV) ⇒ Command + + + + + +

+
+ +

Returns a new instance of Command.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+16
+17
+18
+19
+20
+21
+22
+23
+
+
# File 'lib/youplot/command.rb', line 16
+
+def initialize(argv = ARGV)
+  @argv    = argv
+  @parser  = Parser.new
+  @command = nil
+  @params  = nil
+  @options = nil
+  @backend = YouPlot::Backends::UnicodePlot
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #commandObject + + + + + +

+
+ +

Returns the value of attribute command.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/youplot/command.rb', line 13
+
+def command
+  @command
+end
+
+
+ + + +
+

+ + #dataObject (readonly) + + + + + +

+
+ +

Returns the value of attribute data.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/youplot/command.rb', line 14
+
+def data
+  @data
+end
+
+
+ + + +
+

+ + #optionsObject + + + + + +

+
+ +

Returns the value of attribute options.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/youplot/command.rb', line 13
+
+def options
+  @options
+end
+
+
+ + + +
+

+ + #paramsObject + + + + + +

+
+ +

Returns the value of attribute params.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/youplot/command.rb', line 13
+
+def params
+  @params
+end
+
+
+ + + +
+

+ + #parserObject (readonly) + + + + + +

+
+ +

Returns the value of attribute parser.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/youplot/command.rb', line 14
+
+def parser
+  @parser
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #runObject + + + + + +

+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+
+
# File 'lib/youplot/command.rb', line 30
+
+def run
+  parser.parse_options(@argv)
+  @command ||= parser.command
+  @options ||= parser.options
+  @params  ||= parser.params
+
+  # color command
+  if %i[colors color colours colour].include? @command
+    plot = create_plot
+    output_plot(plot)
+    return
+  end
+
+  # progressive mode
+  if options[:progressive]
+    stop = false
+    Signal.trap(:INT) { stop = true }
+
+    # make cursor invisible
+    options[:output].print "\e[?25l"
+
+    # mainloop
+    while (input = Kernel.gets)
+      n = main_progressive(input)
+      break if stop
+
+      options[:output].print "\e[#{n}F"
+    end
+
+    options[:output].print "\e[0J"
+    # make cursor visible
+    options[:output].print "\e[?25h"
+
+  # normal mode
+  else
+    # Sometimes the input file does not end with a newline code.
+    while (input = Kernel.gets(nil))
+      main(input)
+    end
+  end
+end
+
+
+ +
+

+ + #run_as_executableObject + + + + + +

+ + + + +
+
+
+
+25
+26
+27
+28
+
+
# File 'lib/youplot/command.rb', line 25
+
+def run_as_executable
+  YouPlot.run_as_executable = true
+  run
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot/DSV.html b/YouPlot/DSV.html new file mode 100644 index 0000000..000cc62 --- /dev/null +++ b/YouPlot/DSV.html @@ -0,0 +1,470 @@ + + + + + + + Module: YouPlot::DSV + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: YouPlot::DSV + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/dsv.rb
+
+ +
+ +

Overview

+
+ +

Module to handle DSV (Delimiter-separated values) format. Extract header and series.

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .get_headers(arr, headers, transpose) ⇒ Object + + + + + +

+ + + + +
+
+
+
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+
+
# File 'lib/youplot/dsv.rb', line 57
+
+def get_headers(arr, headers, transpose)
+  # header(-)
+  return nil unless headers
+
+  # header(+) trenspose(+)
+  return arr.map(&:first) if transpose
+
+  # header(+) transpose(-)
+  arr[0]
+end
+
+
+ +
+

+ + .get_series(arr, headers, transpose) ⇒ Object + + + + + +

+ + + + +
+
+
+
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+
+
# File 'lib/youplot/dsv.rb', line 68
+
+def get_series(arr, headers, transpose)
+  # header(-)
+  unless headers
+    return arr if transpose
+
+    return transpose2(arr)
+  end
+
+  # header(+) but no element in the series.
+  # TODO: should raise error?
+  return Array.new(arr[0].size, []) if arr.size == 1
+
+  # header(+) transpose(+)
+  return arr.map { |row| row[1..-1] } if transpose
+
+  # header(+) transpose(-)
+  transpose2(arr[1..-1])
+end
+
+
+ +
+

+ + .parse(input, delimiter, headers, transpose) ⇒ Object + + + + + +

+ + + + +
+
+
+
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+
+
# File 'lib/youplot/dsv.rb', line 11
+
+def parse(input, delimiter, headers, transpose)
+  # Parse as CSV
+  arr = CSV.parse(input, col_sep: delimiter)
+
+  # Remove blank lines
+  arr.delete_if do |i|
+    i == [] or i.all?(&:nil?)
+  end
+
+  # get header
+  headers = get_headers(arr, headers, transpose)
+
+  # get series
+  series = get_series(arr, headers, transpose)
+
+  # Return if No header
+  return Data.new(headers, series) if headers.nil?
+
+  # Warn if header contains nil
+  warn "\e[35mHeaders contains nil in it.\e[0m" if headers.include?(nil)
+
+  # Warn if header contains ''
+  warn "\e[35mHeaders contains \"\" in it.\e[0m" if headers.include? ''
+
+  # Make sure the number of elements in the header matches the number of series.
+  h_size = headers.size
+  s_size = series.size
+
+  if h_size > s_size
+    warn "\e[35mThe number of headers is greater than the number of series.\e[0m"
+    exit 1 if YouPlot.run_as_executable?
+
+  elsif h_size < s_size
+    warn "\e[35mThe number of headers is less than the number of series.\e[0m"
+    exit 1 if YouPlot.run_as_executable?
+  end
+
+  Data.new(headers, series) if h_size == s_size
+end
+
+
+ +
+

+ + .transpose2(arr) ⇒ Object + + + + + +

+
+ +

Transpose different sized ruby arrays stackoverflow.com/q/26016632

+ + +
+
+
+ + +
+ + + + +
+
+
+
+53
+54
+55
+
+
# File 'lib/youplot/dsv.rb', line 53
+
+def transpose2(arr)
+  Array.new(arr.map(&:length).max) { |i| arr.map { |e| e[i] } }
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot/Data.html b/YouPlot/Data.html new file mode 100644 index 0000000..5ab5b36 --- /dev/null +++ b/YouPlot/Data.html @@ -0,0 +1,310 @@ + + + + + + + Class: YouPlot::Data + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: YouPlot::Data + + + +

+
+ +
+
Inherits:
+
+ Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/command.rb
+
+ +
+ + + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #headers ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute headers.

    +
    + +
  • + + +
  • + + + #series ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute series.

    +
    + +
  • + + +
+ + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #headersObject + + + + + +

+
+ +

Returns the value of attribute headers

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of headers

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+10
+11
+12
+
+
# File 'lib/youplot/command.rb', line 10
+
+def headers
+  @headers
+end
+
+
+ + + +
+

+ + #seriesObject + + + + + +

+
+ +

Returns the value of attribute series

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of series

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+10
+11
+12
+
+
# File 'lib/youplot/command.rb', line 10
+
+def series
+  @series
+end
+
+
+ +
+ + +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot/Options.html b/YouPlot/Options.html new file mode 100644 index 0000000..0928959 --- /dev/null +++ b/YouPlot/Options.html @@ -0,0 +1,1113 @@ + + + + + + + Class: YouPlot::Options + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: YouPlot::Options + + + +

+
+ +
+
Inherits:
+
+ Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/options.rb
+
+ +
+ +

Overview

+
+ +

Command line options that are not Plot parameters

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #color_names ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute color_names.

    +
    + +
  • + + +
  • + + + #debug ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute debug.

    +
    + +
  • + + +
  • + + + #delimiter ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute delimiter.

    +
    + +
  • + + +
  • + + + #encoding ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute encoding.

    +
    + +
  • + + +
  • + + + #fmt ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute fmt.

    +
    + +
  • + + +
  • + + + #headers ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute headers.

    +
    + +
  • + + +
  • + + + #output ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute output.

    +
    + +
  • + + +
  • + + + #pass ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute pass.

    +
    + +
  • + + +
  • + + + #progressive ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute progressive.

    +
    + +
  • + + +
  • + + + #reverse ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute reverse.

    +
    + +
  • + + +
  • + + + #transpose ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute transpose.

    +
    + +
  • + + +
+ + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #color_namesObject + + + + + +

+
+ +

Returns the value of attribute color_names

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of color_names

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/youplot/options.rb', line 5
+
+def color_names
+  @color_names
+end
+
+
+ + + +
+

+ + #debugObject + + + + + +

+
+ +

Returns the value of attribute debug

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of debug

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/youplot/options.rb', line 5
+
+def debug
+  @debug
+end
+
+
+ + + +
+

+ + #delimiterObject + + + + + +

+
+ +

Returns the value of attribute delimiter

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of delimiter

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/youplot/options.rb', line 5
+
+def delimiter
+  @delimiter
+end
+
+
+ + + +
+

+ + #encodingObject + + + + + +

+
+ +

Returns the value of attribute encoding

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of encoding

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/youplot/options.rb', line 5
+
+def encoding
+  @encoding
+end
+
+
+ + + +
+

+ + #fmtObject + + + + + +

+
+ +

Returns the value of attribute fmt

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of fmt

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/youplot/options.rb', line 5
+
+def fmt
+  @fmt
+end
+
+
+ + + +
+

+ + #headersObject + + + + + +

+
+ +

Returns the value of attribute headers

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of headers

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/youplot/options.rb', line 5
+
+def headers
+  @headers
+end
+
+
+ + + +
+

+ + #outputObject + + + + + +

+
+ +

Returns the value of attribute output

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of output

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/youplot/options.rb', line 5
+
+def output
+  @output
+end
+
+
+ + + +
+

+ + #passObject + + + + + +

+
+ +

Returns the value of attribute pass

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of pass

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/youplot/options.rb', line 5
+
+def pass
+  @pass
+end
+
+
+ + + +
+

+ + #progressiveObject + + + + + +

+
+ +

Returns the value of attribute progressive

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of progressive

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/youplot/options.rb', line 5
+
+def progressive
+  @progressive
+end
+
+
+ + + +
+

+ + #reverseObject + + + + + +

+
+ +

Returns the value of attribute reverse

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of reverse

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/youplot/options.rb', line 5
+
+def reverse
+  @reverse
+end
+
+
+ + + +
+

+ + #transposeObject + + + + + +

+
+ +

Returns the value of attribute transpose

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of transpose

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/youplot/options.rb', line 5
+
+def transpose
+  @transpose
+end
+
+
+ +
+ + +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot/Parameters.html b/YouPlot/Parameters.html new file mode 100644 index 0000000..b30c86b --- /dev/null +++ b/YouPlot/Parameters.html @@ -0,0 +1,1891 @@ + + + + + + + Class: YouPlot::Parameters + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: YouPlot::Parameters + + + +

+
+ +
+
Inherits:
+
+ Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/parameters.rb
+
+ +
+ +

Overview

+
+ +

UnicodePlot parameters. Why Struct, not Hash?

+
  • +

    The keys are static in Struct.

    +
  • +

    Struct does not conflict with keyword arguments. Hash dose.

    +
+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #border ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute border.

    +
    + +
  • + + +
  • + + + #canvas ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute canvas.

    +
    + +
  • + + +
  • + + + #closed ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute closed.

    +
    + +
  • + + +
  • + + + #color ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute color.

    +
    + +
  • + + +
  • + + + #grid ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute grid.

    +
    + +
  • + + +
  • + + + #height ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute height.

    +
    + +
  • + + +
  • + + + #labels ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute labels.

    +
    + +
  • + + +
  • + + + #margin ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute margin.

    +
    + +
  • + + +
  • + + + #name ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute name.

    +
    + +
  • + + +
  • + + + #nbins ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute nbins.

    +
    + +
  • + + +
  • + + + #padding ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute padding.

    +
    + +
  • + + +
  • + + + #symbol ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute symbol.

    +
    + +
  • + + +
  • + + + #title ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute title.

    +
    + +
  • + + +
  • + + + #width ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute width.

    +
    + +
  • + + +
  • + + + #xlabel ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute xlabel.

    +
    + +
  • + + +
  • + + + #xlim ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute xlim.

    +
    + +
  • + + +
  • + + + #xscale ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute xscale.

    +
    + +
  • + + +
  • + + + #ylabel ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute ylabel.

    +
    + +
  • + + +
  • + + + #ylim ⇒ Object + + + + + + + + + + + + + + + + +
    +

    Returns the value of attribute ylim.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ + + + + + +
+

Instance Attribute Details

+ + + +
+

+ + #borderObject + + + + + +

+
+ +

Returns the value of attribute border

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of border

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def border
+  @border
+end
+
+
+ + + +
+

+ + #canvasObject + + + + + +

+
+ +

Returns the value of attribute canvas

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of canvas

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def canvas
+  @canvas
+end
+
+
+ + + +
+

+ + #closedObject + + + + + +

+
+ +

Returns the value of attribute closed

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of closed

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def closed
+  @closed
+end
+
+
+ + + +
+

+ + #colorObject + + + + + +

+
+ +

Returns the value of attribute color

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of color

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def color
+  @color
+end
+
+
+ + + +
+

+ + #gridObject + + + + + +

+
+ +

Returns the value of attribute grid

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of grid

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def grid
+  @grid
+end
+
+
+ + + +
+

+ + #heightObject + + + + + +

+
+ +

Returns the value of attribute height

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of height

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def height
+  @height
+end
+
+
+ + + +
+

+ + #labelsObject + + + + + +

+
+ +

Returns the value of attribute labels

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of labels

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def labels
+  @labels
+end
+
+
+ + + +
+

+ + #marginObject + + + + + +

+
+ +

Returns the value of attribute margin

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of margin

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def margin
+  @margin
+end
+
+
+ + + +
+

+ + #nameObject + + + + + +

+
+ +

Returns the value of attribute name

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of name

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def name
+  @name
+end
+
+
+ + + +
+

+ + #nbinsObject + + + + + +

+
+ +

Returns the value of attribute nbins

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of nbins

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def nbins
+  @nbins
+end
+
+
+ + + +
+

+ + #paddingObject + + + + + +

+
+ +

Returns the value of attribute padding

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of padding

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def padding
+  @padding
+end
+
+
+ + + +
+

+ + #symbolObject + + + + + +

+
+ +

Returns the value of attribute symbol

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of symbol

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def symbol
+  @symbol
+end
+
+
+ + + +
+

+ + #titleObject + + + + + +

+
+ +

Returns the value of attribute title

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of title

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def title
+  @title
+end
+
+
+ + + +
+

+ + #widthObject + + + + + +

+
+ +

Returns the value of attribute width

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of width

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def width
+  @width
+end
+
+
+ + + +
+

+ + #xlabelObject + + + + + +

+
+ +

Returns the value of attribute xlabel

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of xlabel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def xlabel
+  @xlabel
+end
+
+
+ + + +
+

+ + #xlimObject + + + + + +

+
+ +

Returns the value of attribute xlim

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of xlim

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def xlim
+  @xlim
+end
+
+
+ + + +
+

+ + #xscaleObject + + + + + +

+
+ +

Returns the value of attribute xscale

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of xscale

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def xscale
+  @xscale
+end
+
+
+ + + +
+

+ + #ylabelObject + + + + + +

+
+ +

Returns the value of attribute ylabel

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of ylabel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def ylabel
+  @ylabel
+end
+
+
+ + + +
+

+ + #ylimObject + + + + + +

+
+ +

Returns the value of attribute ylim

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    the current value of ylim

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+8
+9
+10
+
+
# File 'lib/youplot/parameters.rb', line 8
+
+def ylim
+  @ylim
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #to_hcObject + + + + + +

+ + + + +
+
+
+
+30
+31
+32
+
+
# File 'lib/youplot/parameters.rb', line 30
+
+def to_hc
+  to_h.compact
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot/Parser.html b/YouPlot/Parser.html new file mode 100644 index 0000000..904fa01 --- /dev/null +++ b/YouPlot/Parser.html @@ -0,0 +1,1710 @@ + + + + + + + Class: YouPlot::Parser + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: YouPlot::Parser + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/parser.rb
+
+ +
+ +

Overview

+
+ +

Class for parsing command line options

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: Error + + +

+ + + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #command ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
    +

    Returns the value of attribute command.

    +
    + +
  • + + +
  • + + + #main_parser ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
    +

    Returns the value of attribute main_parser.

    +
    + +
  • + + +
  • + + + #options ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
    +

    Returns the value of attribute options.

    +
    + +
  • + + +
  • + + + #params ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
    +

    Returns the value of attribute params.

    +
    + +
  • + + +
  • + + + #sub_parser ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
    +

    Returns the value of attribute sub_parser.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ + + + +
+

Constructor Details

+ +
+

+ + #initializeParser + + + + + +

+
+ +

Returns a new instance of Parser.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+
+
# File 'lib/youplot/parser.rb', line 14
+
+def initialize
+  @command = nil
+
+  @options = Options.new(
+    "\t",    # elimiter:
+    false,   # transpose:
+    nil,     # headers:
+    false,   # pass:
+    $stderr, # output:
+    'xyy',   # fmt:
+    false,   # progressive:
+    nil,     # encoding:
+    false,   # color_names:
+    false    # debug:
+  )
+
+  @params = Parameters.new
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #commandObject (readonly) + + + + + +

+
+ +

Returns the value of attribute command.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/youplot/parser.rb', line 11
+
+def command
+  @command
+end
+
+
+ + + +
+

+ + #main_parserObject (readonly) + + + + + +

+
+ +

Returns the value of attribute main_parser.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/youplot/parser.rb', line 11
+
+def main_parser
+  @main_parser
+end
+
+
+ + + +
+

+ + #optionsObject (readonly) + + + + + +

+
+ +

Returns the value of attribute options.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/youplot/parser.rb', line 11
+
+def options
+  @options
+end
+
+
+ + + +
+

+ + #paramsObject (readonly) + + + + + +

+
+ +

Returns the value of attribute params.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/youplot/parser.rb', line 11
+
+def params
+  @params
+end
+
+
+ + + +
+

+ + #sub_parserObject (readonly) + + + + + +

+
+ +

Returns the value of attribute sub_parser.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/youplot/parser.rb', line 11
+
+def sub_parser
+  @sub_parser
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #create_base_parserObject + + + + + +

+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+
+
# File 'lib/youplot/parser.rb', line 33
+
+def create_base_parser
+  OptionParser.new do |parser|
+    parser.program_name  = 'YouPlot'
+    parser.version       = YouPlot::VERSION
+    parser.summary_width = 23
+    parser.on_tail('') # Add a blank line at the end
+    parser.separator('')
+    parser.on('Common options:')
+    parser.on('-O', '--pass [FILE]', 'file to output input data to [stdout]',
+              'for inserting YouPlot in the middle of Unix pipes') do |v|
+      options[:pass] = v || $stdout
+    end
+    parser.on('-o', '--output [FILE]', 'file to output plots to [stdout]',
+              'If no option is specified, plot will print to stderr') do |v|
+      options[:output] = v || $stdout
+    end
+    parser.on('-d', '--delimiter DELIM', String, 'use DELIM instead of [TAB] for field delimiter') do |v|
+      options[:delimiter] = v
+    end
+    parser.on('-H', '--headers', TrueClass, 'specify that the input has header row') do |v|
+      options[:headers] = v
+    end
+    parser.on('-T', '--transpose', TrueClass, 'transpose the axes of the input data') do |v|
+      options[:transpose] = v
+    end
+    parser.on('-t', '--title STR', String, 'print string on the top of plot') do |v|
+      params.title = v
+    end
+    parser.on('--xlabel STR', String, 'print string on the bottom of the plot') do |v|
+      params.xlabel = v
+    end
+    parser.on('--ylabel STR', String, 'print string on the far left of the plot') do |v|
+      params.ylabel = v
+    end
+    parser.on('-w', '--width INT', Numeric, 'number of characters per row') do |v|
+      params.width = v
+    end
+    parser.on('-h', '--height INT', Numeric, 'number of rows') do |v|
+      params.height = v
+    end
+    border_options = UnicodePlot::BORDER_MAP.keys.join(', ')
+    parser.on('-b', '--border STR', String, 'specify the style of the bounding box', "(#{border_options})") do |v|
+      params.border = v.to_sym
+    end
+    parser.on('-m', '--margin INT', Numeric, 'number of spaces to the left of the plot') do |v|
+      params.margin = v
+    end
+    parser.on('--padding INT', Numeric, 'space of the left and right of the plot') do |v|
+      params.padding = v
+    end
+    parser.on('-c', '--color VAL', String, 'color of the drawing') do |v|
+      params.color = v =~ /\A[0-9]+\z/ ? v.to_i : v.to_sym
+    end
+    parser.on('--[no-]labels', TrueClass, 'hide the labels') do |v|
+      params.labels = v
+    end
+    parser.on('-p', '--progress', TrueClass, 'progressive mode [experimental]') do |v|
+      options[:progressive] = v
+    end
+    parser.on('-C', '--color-output', TrueClass, 'colorize even if writing to a pipe') do |_v|
+      UnicodePlot::IOContext.define_method(:color?) { true } # FIXME
+    end
+    parser.on('-M', '--monochrome', TrueClass, 'no colouring even if writing to a tty') do |_v|
+      UnicodePlot::IOContext.define_method(:color?) { false } # FIXME
+    end
+    parser.on('--encoding STR', String, 'specify the input encoding') do |v|
+      options[:encoding] = v
+    end
+    # Optparse adds the help option, but it doesn't show up in usage.
+    # This is why you need the code below.
+    parser.on('--help', 'print sub-command help menu') do
+      puts parser.help
+      exit if YouPlot.run_as_executable?
+    end
+    parser.on('--debug', TrueClass, 'print preprocessed data') do |v|
+      options[:debug] = v
+    end
+    # yield opt if block_given?
+  end
+end
+
+
+ +
+

+ + #create_main_parserObject + + + + + +

+ + + + +
+
+
+
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+
+
# File 'lib/youplot/parser.rb', line 114
+
+def create_main_parser
+  @main_parser = create_base_parser
+  main_parser.banner = \
+    <<~MSG
+
+      Program: YouPlot (Tools for plotting on the terminal)
+      Version: #{YouPlot::VERSION} (using UnicodePlot #{UnicodePlot::VERSION})
+      Source:  https://github.com/red-data-tools/YouPlot
+
+      Usage:   uplot <command> [options] <in.tsv>
+
+      Commands:
+          barplot    bar           draw a horizontal barplot
+          histogram  hist          draw a horizontal histogram
+          lineplot   line          draw a line chart
+          lineplots  lines         draw a line chart with multiple series
+          scatter    s             draw a scatter plot
+          density    d             draw a density plot
+          boxplot    box           draw a horizontal boxplot
+          count      c             draw a baplot based on the number of
+                                   occurrences (slow)
+          colors     color         show the list of available colors
+
+      General options:
+          --help                   print command specific help menu
+          --version                print the version of YouPlot
+    MSG
+
+  # Help for the main parser is simple.
+  # Simply show the banner above.
+  main_parser.on('--help', 'print sub-command help menu') do
+    puts main_parser.banner
+    puts
+    exit if YouPlot.run_as_executable?
+  end
+end
+
+
+ +
+

+ + #create_sub_parserObject + + + + + +

+ + + + +
+
+
+
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+
+
# File 'lib/youplot/parser.rb', line 205
+
+def create_sub_parser
+  @sub_parser = create_base_parser
+  sub_parser.banner = \
+    <<~MSG
+
+      Usage: YouPlot #{command} [options] <in.tsv>
+
+      Options for #{command}:
+    MSG
+
+  case command
+
+  # If you type only `uplot` in the terminal.
+  when nil
+    warn main_parser.banner
+    warn "\n"
+    exit 1 if YouPlot.run_as_executable?
+
+  when :barplot, :bar
+    sub_parser_add_symbol
+    sub_parser_add_fmt_yx
+    sub_parser_add_xscale
+
+  when :count, :c
+    sub_parser.on_head('-r', '--reverse', TrueClass, 'reverse the result of comparisons') do |v|
+      options.reverse = v
+    end
+    sub_parser_add_symbol
+    sub_parser_add_xscale
+
+  when :histogram, :hist
+    sub_parser_add_symbol
+    sub_parser.on_head('--closed STR', String, 'side of the intervals to be closed [left]') do |v|
+      params.closed = v
+    end
+    sub_parser.on_head('-n', '--nbins INT', Numeric, 'approximate number of bins') do |v|
+      params.nbins = v
+    end
+
+  when :lineplot, :line
+    sub_parser_add_canvas
+    sub_parser_add_grid
+    sub_parser_add_fmt_yx
+    sub_parser_add_ylim
+    sub_parser_add_xlim
+
+  when :lineplots, :lines
+    sub_parser_add_canvas
+    sub_parser_add_grid
+    sub_parser_add_fmt_xyxy
+    sub_parser_add_ylim
+    sub_parser_add_xlim
+
+  when :scatter, :s
+    sub_parser_add_canvas
+    sub_parser_add_grid
+    sub_parser_add_fmt_xyxy
+    sub_parser_add_ylim
+    sub_parser_add_xlim
+
+  when :density, :d
+    sub_parser_add_canvas
+    sub_parser_add_grid
+    sub_parser_add_fmt_xyxy
+    sub_parser_add_ylim
+    sub_parser_add_xlim
+
+  when :boxplot, :box
+    sub_parser_add_xlim
+
+  when :colors, :color, :colours, :colour
+    sub_parser.on_head('-n', '--names', TrueClass, 'show color names only') do |v|
+      options[:color_names] = v
+    end
+
+  else
+    error_message = "uplot: unrecognized command '#{command}'"
+    if YouPlot.run_as_executable?
+      warn error_message
+      exit 1
+    else
+      raise Error, error_message
+    end
+  end
+end
+
+
+ +
+

+ + #parse_options(argv = ARGV) ⇒ Object + + + + + +

+ + + + +
+
+
+
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+
+
# File 'lib/youplot/parser.rb', line 291
+
+def parse_options(argv = ARGV)
+  begin
+    create_main_parser.order!(argv)
+  rescue OptionParser::ParseError => e
+    warn "uplot: #{e.message}"
+    exit 1 if YouPlot.run_as_executable?
+  end
+
+  @command = argv.shift&.to_sym
+
+  begin
+    create_sub_parser&.parse!(argv)
+  rescue OptionParser::ParseError => e
+    warn "uplot: #{e.message}"
+    exit 1 if YouPlot.run_as_executable?
+  end
+end
+
+
+ +
+

+ + #sub_parser_add_canvasObject + + + + + +

+ + + + +
+
+
+
+164
+165
+166
+167
+168
+169
+
+
# File 'lib/youplot/parser.rb', line 164
+
+def sub_parser_add_canvas
+  canvas_types = UnicodePlot::Canvas::CANVAS_CLASS_MAP.keys.join(', ')
+  sub_parser.on_head('--canvas STR', String, 'type of canvas', "(#{canvas_types})") do |v|
+    params.canvas = v.to_sym
+  end
+end
+
+
+ +
+

+ + #sub_parser_add_fmt_xyxyObject + + + + + +

+ + + + +
+
+
+
+189
+190
+191
+192
+193
+194
+195
+
+
# File 'lib/youplot/parser.rb', line 189
+
+def sub_parser_add_fmt_xyxy
+  sub_parser.on_head('--fmt STR', String,
+                     'xyxy : header is like x1, y1, x2, y2, x3, y3...',
+                     'xyy  : header is like x, y1, y2, y2, y3...') do |v|
+    options[:fmt] = v
+  end
+end
+
+
+ +
+

+ + #sub_parser_add_fmt_yxObject + + + + + +

+ + + + +
+
+
+
+197
+198
+199
+200
+201
+202
+203
+
+
# File 'lib/youplot/parser.rb', line 197
+
+def sub_parser_add_fmt_yx
+  sub_parser.on_head('--fmt STR', String,
+                     'xy : header is like x, y...',
+                     'yx : header is like y, x...') do |v|
+    options[:fmt] = v
+  end
+end
+
+
+ +
+

+ + #sub_parser_add_gridObject + + + + + +

+ + + + +
+
+
+
+183
+184
+185
+186
+187
+
+
# File 'lib/youplot/parser.rb', line 183
+
+def sub_parser_add_grid
+  sub_parser.on_head('--[no-]grid', TrueClass, 'draws grid-lines at the origin') do |v|
+    params.grid = v
+  end
+end
+
+
+ +
+

+ + #sub_parser_add_symbolObject + + + + + +

+ + + + +
+
+
+
+151
+152
+153
+154
+155
+
+
# File 'lib/youplot/parser.rb', line 151
+
+def sub_parser_add_symbol
+  sub_parser.on_head('--symbol STR', String, 'character to be used to plot the bars') do |v|
+    params.symbol = v
+  end
+end
+
+
+ +
+

+ + #sub_parser_add_xlimObject + + + + + +

+ + + + +
+
+
+
+171
+172
+173
+174
+175
+
+
# File 'lib/youplot/parser.rb', line 171
+
+def sub_parser_add_xlim
+  sub_parser.on_head('--xlim FLOAT,FLOAT', Array, 'plotting range for the x coordinate') do |v|
+    params.xlim = v.map(&:to_f)
+  end
+end
+
+
+ +
+

+ + #sub_parser_add_xscaleObject + + + + + +

+ + + + +
+
+
+
+157
+158
+159
+160
+161
+162
+
+
# File 'lib/youplot/parser.rb', line 157
+
+def sub_parser_add_xscale
+  xscale_options = UnicodePlot::ValueTransformer::PREDEFINED_TRANSFORM_FUNCTIONS.keys.join(', ')
+  sub_parser.on_head('--xscale STR', String, "axis scaling (#{xscale_options})") do |v|
+    params.xscale = v.to_sym
+  end
+end
+
+
+ +
+

+ + #sub_parser_add_ylimObject + + + + + +

+ + + + +
+
+
+
+177
+178
+179
+180
+181
+
+
# File 'lib/youplot/parser.rb', line 177
+
+def sub_parser_add_ylim
+  sub_parser.on_head('--ylim FLOAT,FLOAT', Array, 'plotting range for the y coordinate') do |v|
+    params.ylim = v.map(&:to_f)
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/YouPlot/Parser/Error.html b/YouPlot/Parser/Error.html new file mode 100644 index 0000000..ef35b98 --- /dev/null +++ b/YouPlot/Parser/Error.html @@ -0,0 +1,124 @@ + + + + + + + Exception: YouPlot::Parser::Error + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Exception: YouPlot::Parser::Error + + + +

+
+ +
+
Inherits:
+
+ StandardError + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/youplot/parser.rb
+
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/_index.html b/_index.html new file mode 100644 index 0000000..3be57b8 --- /dev/null +++ b/_index.html @@ -0,0 +1,248 @@ + + + + + + + Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +

Documentation by YARD 0.9.27

+
+

Alphabetic Index

+ +

File Listing

+ + +
+

Namespace Listing A-Z

+ + + + + + + + +
+ + +
    +
  • B
  • + +
+ + +
    +
  • C
  • +
      + +
    • + Command + + (YouPlot) + +
    • + +
    +
+ + +
    +
  • D
  • +
      + +
    • + DSV + + (YouPlot) + +
    • + +
    • + Data + + (YouPlot) + +
    • + +
    +
+ + +
    +
  • E
  • +
      + +
    • + Error + + (YouPlot::Parser) + +
    • + +
    • + Error + + (YouPlot::Backends::UnicodePlot) + +
    • + +
    +
+ + +
    +
  • O
  • +
      + +
    • + Options + + (YouPlot) + +
    • + +
    +
+ + + + + + + + +
+ + + + +
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/class_list.html b/class_list.html new file mode 100644 index 0000000..a95af45 --- /dev/null +++ b/class_list.html @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + Class List + + + +
+
+

Class List

+ + + +
+ + +
+ + diff --git a/css/common.css b/css/common.css new file mode 100644 index 0000000..cf25c45 --- /dev/null +++ b/css/common.css @@ -0,0 +1 @@ +/* Override this file with custom rules */ \ No newline at end of file diff --git a/css/full_list.css b/css/full_list.css new file mode 100644 index 0000000..fa35982 --- /dev/null +++ b/css/full_list.css @@ -0,0 +1,58 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; + background: #fafafa; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +.fixed_header { position: fixed; background: #fff; width: 100%; padding-bottom: 10px; margin-top: 0; top: 0; z-index: 9999; height: 70px; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; margin-top: 80px; font-size: 1.1em; } +#full_list ul { padding: 0; } +#full_list li { padding: 0; margin: 0; list-style: none; } +#full_list li .item { padding: 5px 5px 5px 12px; } +#noresults { padding: 7px 12px; background: #fff; } +#content.insearch #noresults { margin-left: 7px; } +li.collapsed ul { display: none; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.odd { background: #f0f0f0; } +li.even { background: #fafafa; } +.item:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a, a:visited { text-decoration: none; color: #05a; } +li.clicked > .item { background: #05a; color: #ccc; } +li.clicked > .item a, li.clicked > .item a:visited { color: #eee; } +li.clicked > .item a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; border-radius: 3px; } +#full_list_nav { margin-left: 10px; font-size: 0.9em; display: block; color: #aaa; } +#full_list_nav a, #nav a:visited { color: #358; } +#full_list_nav a:hover { background: transparent; color: #5af; } +#full_list_nav span:after { content: ' | '; } +#full_list_nav span:last-child:after { content: ''; } + +#content h1 { margin-top: 0; } +li { white-space: nowrap; cursor: normal; } +li small { display: block; font-size: 0.8em; } +li small:before { content: ""; } +li small:after { content: ""; } +li small.search_info { display: none; } +#search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +#content.insearch #search { background-position: center right; } +#search input { width: 110px; } + +#full_list.insearch ul { display: block; } +#full_list.insearch .item { display: none; } +#full_list.insearch .found { display: block; padding-left: 11px !important; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..eb0dbc8 --- /dev/null +++ b/css/style.css @@ -0,0 +1,497 @@ +html { + width: 100%; + height: 100%; +} +body { + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + width: 100%; + margin: 0; + padding: 0; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; +} + +#nav { + position: relative; + width: 100%; + height: 100%; + border: 0; + border-right: 1px dotted #eee; + overflow: auto; +} +.nav_wrap { + margin: 0; + padding: 0; + width: 20%; + height: 100%; + position: relative; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; + flex-shrink: 0; + -webkit-flex-shrink: 0; + -ms-flex: 1 0; +} +#resizer { + position: absolute; + right: -5px; + top: 0; + width: 10px; + height: 100%; + cursor: col-resize; + z-index: 9999; +} +#main { + flex: 5 1; + -webkit-flex: 5 1; + -ms-flex: 5 1; + outline: none; + position: relative; + background: #fff; + padding: 1.2em; + padding-top: 0.2em; + box-sizing: border-box; +} + +@media (max-width: 920px) { + .nav_wrap { width: 100%; top: 0; right: 0; overflow: visible; position: absolute; } + #resizer { display: none; } + #nav { + z-index: 9999; + background: #fff; + display: none; + position: absolute; + top: 40px; + right: 12px; + width: 500px; + max-width: 80%; + height: 80%; + overflow-y: scroll; + border: 1px solid #999; + border-collapse: collapse; + box-shadow: -7px 5px 25px #aaa; + border-radius: 2px; + } +} + +@media (min-width: 920px) { + body { height: 100%; overflow: hidden; } + #main { height: 100%; overflow: auto; } + #search { display: none; } +} + +#main img { max-width: 100%; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; + position: relative; +} +h2 small { font-weight: normal; font-size: 0.7em; display: inline; position: absolute; right: 0; } +h2 small a { + display: block; + height: 20px; + border: 1px solid #aaa; + border-bottom: 0; + border-top-left-radius: 5px; + background: #f8f8f8; + position: relative; + padding: 2px 7px; +} +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring, .tags, #filecontents { font-size: 15px; line-height: 1.5145em; } +.docstring p > code, .docstring p > tt, .tags p > code, .tags p > tt { + color: #c7254e; background: #f9f2f4; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link a, .docstring .object_link a { + font-family: monospace; font-size: 1.05em; + color: #05a; background: #EDF4FA; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.rdoc-term { padding-right: 25px; font-weight: bold; } +.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } +.summary_desc pre.code .object_link a, .docstring pre.code .object_link a { + padding: 0px; background: inherit; color: inherit; border-radius: inherit; +} + +/* style for */ +#filecontents table, .docstring table { border-collapse: collapse; } +#filecontents table th, #filecontents table td, +.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; } +#filecontents table tr:nth-child(odd), +.docstring table tr:nth-child(odd) { background: #eee; } +#filecontents table tr:nth-child(even), +.docstring table tr:nth-child(even) { background: #fff; } +#filecontents table th, .docstring table th { background: #fff; } + +/* style for
+ + + + + + + + + + + + + + + + + + + + + + + +
CommandDescription
`cat data.tsv \uplot <command> [options]`Take input from stdin
`uplot <command> [options] data.tsv ...`Take input from files
`pipeline1 \uplot <command> -O \pipeline2`Outputs data from stdin to stdout
+ +

Subcommands

+ +

The following sub-commands are available.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
commandshorthow it works
barplotbardraw a horizontal barplot
histogramhistdraw a horizontal histogram
lineplotlinedraw a line chart
lineplotslinesdraw a line chart with multiple series
scattersdraw a scatter plot
densityddraw a density plot
boxplotboxdraw a horizontal boxplot
countcdraw a barplot based on the number of occurrences (slow)
colorscolorshow the list of available colors
+ +

Output the plot

+ + +

Output the input data

+ + +

Header

+ + +

Delimiter

+ + +

Real-time data

+ + +

Show detailed options for subcommands

+ + +

Set columns as x-axis or y-axis

+ + +

Categorical data

+ + +

Time series

+ + +

Tools that are useful to use with YouPlot

+ + +

Contributing

+ +

YouPlot is a library under development, so even small improvements like typofix are welcome! Please feel free to send us your pull requests.

+ + +

Development

+ +
# fork the main repository by clicking the Fork button. 
+git clone https://github.com/your_name/YouPlot
+bundle install             # Install the gem dependencies
+bundle exec rake test      # Run the test
+bundle exec rake install   # Installation from source code
+bundle exec exe/uplot      # Run youplot (Try out the edited code)
+
+ +
Do you need commit rights to my repository?
+Do you want to get admin rights and take over the project?
+If so, please feel free to contact us.
+
+ +

Acknowledgements

+ + +

License

+ +

MIT License.

+ + + + + + + \ No newline at end of file diff --git a/file_list.html b/file_list.html new file mode 100644 index 0000000..2b6df40 --- /dev/null +++ b/file_list.html @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + File List + + + +
+
+

File List

+ + + +
+ + +
+ + diff --git a/frames.html b/frames.html new file mode 100644 index 0000000..54704af --- /dev/null +++ b/frames.html @@ -0,0 +1,17 @@ + + + + + Documentation by YARD 0.9.27 + + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..fe7fac9 --- /dev/null +++ b/index.html @@ -0,0 +1,410 @@ + + + + + + + File: README + + — Documentation by YARD 0.9.27 + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+ Build Status + Gem Version + DOI + Docs Stable + The MIT License + + YouPlot is a command line tool that draws plots on the terminal. + + :bar_chart: Powered by [UnicodePlot](https://github.com/red-data-tools/unicode_plot.rb) +
+

Installation

+ +
gem install youplot
+
+ +

Quick Start

+ +

<img alt=“barplot” src=“” width=160> <img alt=“histogram” src=“” width=160> <img alt=“scatter” src=“” width=160> <img alt=“density” src=“” width=160> <img alt=“boxplot” src=“” width=160>

+ +

uplot <command> [options] <data.tsv>

+ +

barplot

+ +
curl -sL https://git.io/ISLANDScsv \
+| sort -nk2 -t, \
+| tail -n15 \
+| uplot bar -d, -t "Areas of the World's Major Landmasses"
+
+

+ barplot +

+

histogram

+ +
echo -e "from numpy import random;" \
+        "n = random.randn(10000);"  \
+        "print('\\\n'.join(str(i) for i in n))" \
+| python \
+| uplot hist --nbins 20
+
+

+ histogram +

+

lineplot

+ +
curl -sL https://git.io/AirPassengers \
+| cut -f2,3 -d, \
+| uplot line -d, -w 50 -h 15 -t AirPassengers --xlim 1950,1960 --ylim 0,600
+
+

+ lineplot +

+

scatter

+ +
curl -sL https://git.io/IRIStsv \
+| cut -f1-4 \
+| uplot scatter -H -t IRIS
+
+

+ scatter +

+

density

+ +
curl -sL https://git.io/IRIStsv \
+| cut -f1-4 \
+| uplot density -H -t IRIS
+
+

+ density +

+

boxplot

+ +
curl -sL https://git.io/IRIStsv \
+| cut -f1-4 \
+| uplot boxplot -H -t IRIS
+
+

+ boxplot +

+

count

+ +
cat gencode.v35.annotation.gff3 \
+| grep -v '#' | grep 'gene' | cut -f1 \
+| uplot count -t "The number of human gene annotations per chromosome"  -c blue
+
+

+ count +

+

In this example, YouPlot counts the number of chromosomes where genes are located. * GENCODE - Human Release

+ +

Note: count is not very fast because it runs in a Ruby script. This is fine in most cases, as long as the data size is small. If you want to visualize huge data, it is faster to use a combination of common Unix commands as shown below.

+ +
cat gencode.v35.annotation.gff3 | grep -v '#' | grep 'gene' | cut -f1 \
+| sort | uniq -c | sort -nrk1 \
+| uplot bar --fmt yx -d ' ' -t "The number of human gene annotations per chromosome"  -c blue
+
+ +

Usage

+ +

Commands

+ +

uplot is the shortened form of youplot. You can use either.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
CommandDescription
`cat data.tsv \uplot <command> [options]`Take input from stdin
`uplot <command> [options] data.tsv ...`Take input from files
`pipeline1 \uplot <command> -O \pipeline2`Outputs data from stdin to stdout
+ +

Subcommands

+ +

The following sub-commands are available.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
commandshorthow it works
barplotbardraw a horizontal barplot
histogramhistdraw a horizontal histogram
lineplotlinedraw a line chart
lineplotslinesdraw a line chart with multiple series
scattersdraw a scatter plot
densityddraw a density plot
boxplotboxdraw a horizontal boxplot
countcdraw a barplot based on the number of occurrences (slow)
colorscolorshow the list of available colors
+ +

Output the plot

+
  • +

    -o

    +
  • +

    By default, the plot is output to standard error output.

    +
  • +

    If you want to output to standard input, Use hyphen -o - or no argument uplot s -o |.

    +
+ +

Output the input data

+
  • +

    -O

    +
  • +

    By default, the input data is not shown anywhere.

    +
  • +

    If you want to pass the input data directly to the standard output, Use hyphen -O - or no argument uplot s -O |.

    +
  • +

    This is useful when passing data to a subsequent pipeline.

    +
+ +

Header

+
  • +

    -H

    +
  • +

    If input data contains a header line, you need to specify the -H option.

    +
+ +

Delimiter

+
  • +

    -d

    +
  • +

    You do not need to use -d option for tab-delimited text since the default value is tab.

    +
  • +

    To specify a blank space, you can use uplot bar -d ' ' data.txt.

    +
+ +

Real-time data

+
  • +

    -p --progress

    +
  • +

    Experimental progressive mode is currently under development.

    +
  • +

    ruby -e 'loop{puts rand(100)}' | uplot line --progress

    +
+ +

Show detailed options for subcommands

+
  • +

    --help

    +
  • +

    The --help option will show more detailed options for each subcommand.

    +
  • +

    uplot hist --help

    +
+ +

Set columns as x-axis or y-axis

+
  • +

    YouPlot treats the first column as the X axis and the second column as the Y axis. When working with multiple series, the first column is the X axis, the second column is series Y1, the third column is series Y2, and so on.

    +
  • +

    If you pass only one column of data for line and bar, YouPlot will automatically use a sequential number starting from 1 as the X-axis.

    +
  • +

    --fmt

    +
  • +

    --fmt xyy --fmt xyxy --fmt yx options give you a few more choices. See youplot <command> --help for more details.

    +
  • +

    The fmt option may be renamed in the future.

    +
  • +

    The -x and -y options might be used to specify columns in the future.

    +
  • +

    Use awk '{print $2, $1}' to swap columns. Use paste to concatenate series.

    +
+ +

Categorical data

+
  • +

    With GNU datamash, you can manage to handle categorized data.

    +
  • +

    cat test/fixtures/iris.csv | sed '/^$/d' | datamash --header-in --output-delimiter=: -t, -g5 collapse 3,4 | cut -f2-3 -d: | sed 's/:/\n/g' | uplot s -d, -T --fmt xyxy

    +
  • +

    This is not so easy…

    +
+ +

Time series

+
  • +

    Not yet supported.

    +
+ +

Tools that are useful to use with YouPlot

+ + +

Contributing

+ +

YouPlot is a library under development, so even small improvements like typofix are welcome! Please feel free to send us your pull requests.

+
  • +

    Report bugs

    +
  • +

    Fix bugs and submit pull requests

    +
  • +

    Write, clarify, or fix documentation

    +
  • +

    English corrections by native speakers are welcome.

    +
  • +

    Suggest or add new features

    +
  • +

    Make a donation

    +
+ +

Development

+ +
# fork the main repository by clicking the Fork button. 
+git clone https://github.com/your_name/YouPlot
+bundle install             # Install the gem dependencies
+bundle exec rake test      # Run the test
+bundle exec rake install   # Installation from source code
+bundle exec exe/uplot      # Run youplot (Try out the edited code)
+
+ +
Do you need commit rights to my repository?
+Do you want to get admin rights and take over the project?
+If so, please feel free to contact us.
+
+ +

Acknowledgements

+ + +

License

+ +

MIT License.

+
+ + + +
+ + \ No newline at end of file diff --git a/js/app.js b/js/app.js new file mode 100644 index 0000000..8d067fe --- /dev/null +++ b/js/app.js @@ -0,0 +1,314 @@ +(function() { + +var localStorage = {}, sessionStorage = {}; +try { localStorage = window.localStorage; } catch (e) { } +try { sessionStorage = window.sessionStorage; } catch (e) { } + +function createSourceLinks() { + $('.method_details_list .source_code'). + before("[View source]"); + $('.toggleSource').toggle(function() { + $(this).parent().nextAll('.source_code').slideDown(100); + $(this).text("Hide source"); + }, + function() { + $(this).parent().nextAll('.source_code').slideUp(100); + $(this).text("View source"); + }); +} + +function createDefineLinks() { + var tHeight = 0; + $('.defines').after(" more..."); + $('.toggleDefines').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).prev().css('display', 'inline'); + $(this).parent().prev().height($(this).parent().height()); + $(this).text("(less)"); + }, + function() { + $(this).prev().hide(); + $(this).parent().prev().height(tHeight); + $(this).text("more..."); + }); +} + +function createFullTreeLinks() { + var tHeight = 0; + $('.inheritanceTree').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).parent().toggleClass('showAll'); + $(this).text("(hide)"); + $(this).parent().prev().height($(this).parent().height()); + }, + function() { + $(this).parent().toggleClass('showAll'); + $(this).parent().prev().height(tHeight); + $(this).text("show all"); + }); +} + +function searchFrameButtons() { + $('.full_list_link').click(function() { + toggleSearchFrame(this, $(this).attr('href')); + return false; + }); + window.addEventListener('message', function(e) { + if (e.data === 'navEscape') { + $('#nav').slideUp(100); + $('#search a').removeClass('active inactive'); + $(window).focus(); + } + }); + + $(window).resize(function() { + if ($('#search:visible').length === 0) { + $('#nav').removeAttr('style'); + $('#search a').removeClass('active inactive'); + $(window).focus(); + } + }); +} + +function toggleSearchFrame(id, link) { + var frame = $('#nav'); + $('#search a').removeClass('active').addClass('inactive'); + if (frame.attr('src') === link && frame.css('display') !== "none") { + frame.slideUp(100); + $('#search a').removeClass('active inactive'); + } + else { + $(id).addClass('active').removeClass('inactive'); + if (frame.attr('src') !== link) frame.attr('src', link); + frame.slideDown(100); + } +} + +function linkSummaries() { + $('.summary_signature').click(function() { + document.location = $(this).find('a').attr('href'); + }); +} + +function summaryToggle() { + $('.summary_toggle').click(function(e) { + e.preventDefault(); + localStorage.summaryCollapsed = $(this).text(); + $('.summary_toggle').each(function() { + $(this).text($(this).text() == "collapse" ? "expand" : "collapse"); + var next = $(this).parent().parent().nextAll('ul.summary').first(); + if (next.hasClass('compact')) { + next.toggle(); + next.nextAll('ul.summary').first().toggle(); + } + else if (next.hasClass('summary')) { + var list = $('