Skip to content

Commit 6f11232

Browse files
author
Ivan Evgrafov
authored
Merge pull request #12 from abinoam/readme_md
Convert and fix README.rdoc to README.md
2 parents 0f4de3e + 7b16070 commit 6f11232

File tree

3 files changed

+193
-166
lines changed

3 files changed

+193
-166
lines changed

README.md

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# GnuplotRB
2+
GnuplotRB is a plot generator for Ruby based on
3+
[Gnuplot](http://www.gnuplot.info).
4+
5+
This software has been developed as a product in Google Summer of Code 2015 (GSoC2015). Its progress may be saw in [SciRuby mailing list](https://groups.google.com/forum/?fromgroups#!topic/sciruby-dev/lhWvb5hWc3k) or in [project's blog](http://www.evgrafov.work/gnuplotrb/).
6+
7+
[![Gem Version](https://badge.fury.io/rb/gnuplotrb.svg)](https://badge.fury.io/rb/gnuplotrb)
8+
[![Dependency Status](https://gemnasium.com/badges/github.com/SciRuby/gnuplotrb.svg)](https://gemnasium.com/github.com/SciRuby/gnuplotrb)
9+
[![Build Status](https://travis-ci.org/SciRuby/gnuplotrb.svg?branch=master)](https://travis-ci.org/SciRuby/gnuplotrb)
10+
[![Code Climate](https://codeclimate.com/github/SciRuby/gnuplotrb/badges/gpa.svg)](https://codeclimate.com/github/SciRuby/gnuplotrb)
11+
[![Test Coverage](https://codeclimate.com/github/SciRuby/gnuplotrb/badges/coverage.svg)](https://codeclimate.com/github/SciRuby/gnuplotrb/coverage)
12+
13+
## Table of contents
14+
* [Installation](https://github.com/sciruby/gnuplotrb#installation)
15+
* [Getting started](https://github.com/sciruby/gnuplotrb#getting-started)
16+
- [Plottable classes](https://github.com/sciruby/gnuplotrb#plottable-classes)
17+
- [Notebooks](https://github.com/sciruby/gnuplotrb#notebooks)
18+
- [Plain examples](https://github.com/sciruby/gnuplotrb#plain-examples)
19+
* [Contributing](https://github.com/sciruby/gnuplotrb#contributing)
20+
21+
## Installation
22+
### Dependencies
23+
* Ruby 2.0+
24+
* It is required to install [gnuplot 5.0](http://www.gnuplot.info/download.html) to use that gem.
25+
26+
### Gem installation
27+
#### Install latest stable version from Rubygems
28+
29+
```sh
30+
gem install gnuplotrb
31+
```
32+
33+
#### Install latest stable version using bundler
34+
* add `gem gnuplotrb` to your `Gemfile`
35+
* run `bundle install`
36+
37+
#### Install latest version from source (may be unstable)
38+
39+
```sh
40+
git clone https://github.com/sciruby/gnuplotrb.git
41+
cd gnuplotrb
42+
bundle install
43+
rake install
44+
```
45+
46+
## Getting started
47+
GnuplotRB gem is based on [Gnuplot](http://www.gnuplot.info/) so I would recommend to use [Gnuplot doc](http://www.gnuplot.info/docs_5.0/gnuplot.pdf) and [GnuplotRB doc at Rubydoc](https://rubygems.org/gems/gnuplotrb) in cases when docs and examples (as notebooks and plain examples) present here are not enough to explain how to plot something.
48+
49+
### Plottable classes
50+
Each of plottable classes may be outputted to image file using ```#to_png```, ```#to_svg```, ```#to_gif``` and so on methods. You can read more about it in [GnuplotRB doc](https://rubygems.org/gems/gnuplotrb) related to Plottable module or see examples in [beginners
51+
notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/basic_usage.ipynb).
52+
53+
#### Dataset
54+
Single dataset may be created with math formula ('sin(x)') or some data. If your data is stored in a file you can just pass a filename (e.g. 'gnuplotrb.data'). Dataset may also be constructed out of data contained in Ruby classes (Array, Daru containers), see [example notebooks](https://github.com/sciruby/gnuplotrb#possible-datasources).
55+
56+
Dataset have several possible options which are explained in [gnuplot
57+
doc](http://www.gnuplot.info/docs_5.0/gnuplot.pdf) (pp. 80-102). Options are passed to Dataset.new as hash and are tranlated into gnuplot format before plotting:
58+
59+
```ruby
60+
Dataset.new(data, with: 'lines', using: '1:2')
61+
```
62+
63+
Examples of option translation (nested containers allowed):
64+
65+
* Hash:
66+
67+
```ruby
68+
{ key1: "value1", key2: { nested_key1: "nested_value1" } } # => "key1 value1 key2 nested key1 nested_value1"
69+
```
70+
71+
* Hashes with underscored keys (see [#7](https://github.com/dilcom/gnuplotrb/issues/7)):
72+
73+
```ruby
74+
{ style_data: 'histograms' } #=> "style data histograms"
75+
```
76+
77+
* Range:
78+
79+
```ruby
80+
{ xrange: 0..100 } # => "xrange [0:100]"
81+
```
82+
83+
* Array (often used with nested hashes) and Array of Numeric
84+
85+
```ruby
86+
['png', { size: [400, 500] }] # => "png size 400,500"
87+
```
88+
89+
* Others
90+
91+
```ruby
92+
some_object # => some_object.to_s
93+
```
94+
95+
Once Dataset created, it may be updated with new data or options. Methods related to updating are explained in [a notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/updating_data.ipynb).
96+
97+
Just as other Plottable object Dataset has several plotting methods which are desribed in [beginners notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/basic_usage.ipynb).
98+
99+
#### Plot
100+
Plot is a container for several datasets and layout options:
101+
```ruby
102+
Plot.new(ds1, ds2, ds2, xrange: 1..10)
103+
```
104+
105+
Datasets contained bu Plot are outputted on single xy plain.
106+
107+
Plot's options are explained in [gnuplot doc](http://www.gnuplot.info/docs_5.0/gnuplot.pdf) (pp. 105-181). Plot options are translated into gnuplot format the same way as Dataset's (except adding 'set' before each option). Plot's datasets and Plot itself may be updated with almost the same methods as desribed in Dataset section above.
108+
109+
#### Splot
110+
Almost the same as Plot but for 3-D plots. See Plot section.
111+
112+
#### Multiplot
113+
114+
Container for several Plot or Splot objects, each of them is plotted in its own xy(z) space. So Multiplot offers single layout (image filewindow) for several plots. It's grid is tuned by :layout option, and you can also set layout's title:
115+
```ruby
116+
Multiplot.new(plot1, plot2, splot1, layout: [3, 1], title: 'Three plots on a layout')
117+
```
118+
119+
Updating methods for Multiplot are almost the same as Plot's and Dataset's and are covered in Multiplot's docs and [multiplot notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/multiplot_layout.ipynb). See examples there.
120+
121+
#### Animation
122+
123+
Animation is a container for several Plot, Splot or Multiplot objects. Each of contained items is considered as frame in gif animation which is creating by ```#plot``` call. Animation's frames and options may be modifyed or updated just as other classes above. Animation does not support methods like ```#to_png``` and may be plotted only with ```#plot``` method. Please see [related notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/animated_plots.ipynb) and docs at RubyDoc for examples.
124+
125+
### Notebooks
126+
127+
This notebooks are powered by [Ruby kernel](https://github.com/SciRuby/iruby/) for [IPython/Jupyter](https://jupyter.org/). I placed them here to show some GnuplotRB's capabilities and ways of using it together with iRuby.
128+
129+
To use GnuplotRB gem with iRuby you need to install them both.
130+
131+
* iRuby installation is covered in its [README](https://github.com/SciRuby/iruby/blob/master/README.md). It also covers installation of iPython and other dependecies.
132+
* GnuplotRB gem installation covered in [README](https://github.com/sciruby/gnuplotrb#installation) too.
133+
134+
135+
#### Embedding plots into iRuby
136+
Using GnuplotRB inside iRuby notebooks is covered in:
137+
138+
* [Basic usage notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/basic_usage.ipynb).
139+
140+
#### 2D and 3D plots
141+
GnuplotRB is capable to plot vast range of plots from histograms to 3D
142+
heatmaps. Gem's repository contains examples of several plot types:
143+
144+
* [Heatmaps](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/heatmaps.ipynb)
145+
* [Vectorfield](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/vector_field.ipynb) (Thanks, [Alexej](https://github.com/agisga))
146+
* [Math equations](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/math_plots.ipynb)
147+
* [3D visualizations](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/3d_plot.ipynb)
148+
* [Histogram](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/histogram.ipynb)
149+
150+
151+
#### Possible datasources
152+
GnuplotRB may take data in Ruby container or in a file. Supported containers
153+
for now are `Array`, `Daru::Vector` and `Daru::DataFrame`. When data given in file,
154+
GnuplotRB pass filename to Gnuplot **without** reading the file into memory.
155+
156+
Examples of using different datasources:
157+
158+
* [Data given in file or Ruby Array](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/points_from_different_sources.ipynb)
159+
* [Data given in Daru containers](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/plotting_from_daru.ipynb)
160+
* [Data given in Daru containers (with timeseries)](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/time_series_from_daru.ipynb)
161+
* [Updating plots with new data](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/updating_data.ipynb)
162+
163+
164+
#### Multiplot
165+
You can not only plot several datasets in single coordinate system but place
166+
several coordinate systems on a canvas.
167+
168+
* [Multiplot example notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/multiplot_layout.ipynb).
169+
170+
#### Animation
171+
It's possible to use several plots (Plot, Splot or Multiplot objects) to create gif animation.
172+
173+
* [Animation example notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/animated_plots.ipynb).
174+
175+
176+
#### Fitting data with formula
177+
GnuplotRB also may be used to fit some data with given math formula.
178+
179+
* [Fitting data](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/fitting_data.ipynb)
180+
181+
182+
### Plain examples
183+
You may find several examples in [examples directory](https://github.com/sciruby/gnuplotrb/tree/master/examples).
184+
185+
## Contributing
186+
187+
1. [Fork repository](https://github.com/sciruby/gnuplotrb/fork)
188+
2. Create your feature branch (`git checkout -b my-new-feature`)
189+
3. Commit your changes (`git commit -am 'Add some feature'`)
190+
4. Push to the branch (`git push origin my-new-feature`)
191+
5. Create a new Pull Request
192+

README.rdoc

Lines changed: 0 additions & 165 deletions
This file was deleted.

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
1010
end
1111

1212
YARD::Rake::YardocTask.new(:doc) do |t|
13-
t.files = %w(README.rdoc lib) # optional
13+
t.files = %w(README.md lib) # optional
1414
end
1515

1616
RuboCop::RakeTask.new(:cop)

0 commit comments

Comments
 (0)