10 Commits

Author SHA1 Message Date
kojix2
e76d4f279e v0.4.3 2021-11-19 14:09:46 +09:00
kojix2
3a1a29424d Remove add_development_dependency from gem 2021-11-19 14:03:57 +09:00
kojix2
b78da2388a Rubocop auto correct 2021-11-19 13:56:09 +09:00
KIKISeries
a7bb75e87d Fix a typo
S -> s
2021-07-14 09:56:47 +09:00
kojix2
ca9f97a7dc Specify the version of UnicodePlot 2021-07-12 14:56:41 +09:00
kojix2
f67a5ce913 Add comments on the run_as_executable variable 2021-07-12 14:49:34 +09:00
kojix2
dbbfd366be Remove unused variable 2021-07-11 08:59:44 +09:00
kojix2
42cadee553 Improved CI
Remove needless line
2021-07-11 08:43:47 +09:00
kojix2
e689c69838 Update CI
* Enable bundler-cache
2021-07-11 08:38:05 +09:00
kojix2
c53169e9ee Update README.md (#24) 2021-07-03 07:22:19 +09:00
8 changed files with 22 additions and 18 deletions

View File

@@ -13,6 +13,5 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: gem install bundler
- run: bundle install
bundler-cache: true
- run: bundle exec rake test

View File

@@ -4,3 +4,9 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in youplot.gemspec
gemspec
group :test do
gem 'rake'
gem 'simplecov'
gem 'test-unit'
end

View File

@@ -7,7 +7,7 @@
<a href="https://rubydoc.info/gems/youplot/"><img alt="Docs Stable" src="https://img.shields.io/badge/docs-stable-blue.svg"></a>
<a href="LICENSE.txt"><img alt="The MIT License" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
YouPlot is a command line tool that draws plots in the terminal.
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)
</div>
@@ -189,7 +189,7 @@ The following sub-commands are available.
* The `--help` option will show more detailed options for each subcommand.
* `uplot hist --help`
### Set columns as x-axis or y-axis?
### 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.
@@ -203,7 +203,7 @@ The following sub-commands are available.
### Categorical data
* With gne datamash, you can manage to handle categorized 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...

View File

@@ -6,6 +6,12 @@ require_relative 'youplot/parameters'
require_relative 'youplot/command'
module YouPlot
# @run_as_executable = true / false
# YouPlot behaves slightly differently when run as a command line tool
# and when run as a script (e.g. for testing). In the event of an error,
# when run as a command line tool, YouPlot will display a short error message
# and exit abnormally. When run as a script, it will just raise an error.
@run_as_executable = false
class << self
attr_accessor :run_as_executable
@@ -13,5 +19,4 @@ module YouPlot
@run_as_executable
end
end
@run_as_executable = false
end

View File

@@ -127,11 +127,10 @@ module YouPlot
def plot_xyxy(data, method1, params)
headers = data.headers
series = data.series
series2 = data.series
.map { |s| s.map(&:to_f) }
.each_slice(2).to_a
method2 = get_method2(method1)
series.map! { |s| s.map(&:to_f) }
series2 = series.each_slice(2).to_a
series = nil
params.name ||= headers[0] if headers
params.xlim ||= series2.map(&:first).flatten.minmax # why need?
params.ylim ||= series2.map(&:last).flatten.minmax # why need?

View File

@@ -95,7 +95,7 @@ module YouPlot
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|
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.

View File

@@ -1,5 +1,5 @@
# frozen_string_literal: true
module YouPlot
VERSION = '0.4.2'
VERSION = '0.4.3'
end

View File

@@ -19,10 +19,5 @@ Gem::Specification.new do |spec|
spec.executables = %w[uplot youplot]
spec.require_paths = ['lib']
spec.add_runtime_dependency 'unicode_plot'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'test-unit'
spec.add_dependency 'unicode_plot', '>= 0.0.5'
end