Skip to content

Commit 1972a3a

Browse files
committed
Fix indenting and syntax highlighting
1 parent e86e0ef commit 1972a3a

File tree

1 file changed

+86
-148
lines changed

1 file changed

+86
-148
lines changed

README.md

Lines changed: 86 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# GnuplotRB
2-
32
GnuplotRB is a plot generator for Ruby based on
43
[Gnuplot](http://www.gnuplot.info).
54

@@ -22,227 +21,166 @@ This software has been developed as a product in Google Summer of Code 2015 (GSo
2221
## Installation
2322
### Dependencies
2423
* Ruby 2.0+
25-
* It is required to install [gnuplot
26-
5.0](http://www.gnuplot.info/download.html) to use that gem.
24+
* It is required to install [gnuplot 5.0](http://www.gnuplot.info/download.html) to use that gem.
2725

2826
### Gem installation
2927
#### Install latest stable version from Rubygems
30-
gem install gnuplotrb
31-
32-
#### Install latest stable version using bundler
33-
* add
34-
gem 'gnuplotrb'
3528

36-
to your Gemfile
37-
* run
38-
bundle install
29+
```sh
30+
gem install gnuplotrb
31+
```
3932

33+
#### Install latest stable version using bundler
34+
* add `gem gnuplotrb` to your `Gemfile`
35+
* run `bundle install`
4036

4137
#### Install latest version from source (may be unstable)
42-
git clone https://github.com/sciruby/gnuplotrb.git
43-
cd gnuplotrb
44-
bundle install
45-
rake install
4638

47-
## Getting started
39+
```sh
40+
git clone https://github.com/sciruby/gnuplotrb.git
41+
cd gnuplotrb
42+
bundle install
43+
rake install
44+
```
4845

49-
GnuplotRB gem is based on [Gnuplot](http://www.gnuplot.info/) so I would
50-
recommend to use [Gnuplot doc](http://www.gnuplot.info/docs_5.0/gnuplot.pdf)
51-
and [GnuplotRB doc at Rubydoc](https://rubygems.org/gems/gnuplotrb) in cases
52-
when docs and examples (as notebooks and plain examples) present here are not
53-
enough to explain how to plot something.
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.
5448

5549
### Plottable classes
56-
57-
Each of plottable classes may be outputted to image file using ```#to_png```,
58-
```#to_svg```, ```#to_gif``` and so on methods. You can read more about it in
59-
[GnuplotRB doc](https://rubygems.org/gems/gnuplotrb) related to Plottable
60-
module or see examples in [beginners
61-
notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/not
62-
ebooks/basic_usage.ipynb).
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).
6352

6453
#### Dataset
65-
Single dataset may be created with math formula ('sin(x)') or some data. If
66-
your data is stored in a file you can just pass a filename (e.g.
67-
'gnuplotrb.data'). Dataset may also be constructed out of data contained in
68-
Ruby classes (Array, Daru containers), see [example
69-
notebooks](https://github.com/sciruby/gnuplotrb#possible-datasources).
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).
7055

7156
Dataset have several possible options which are explained in [gnuplot
72-
doc](http://www.gnuplot.info/docs_5.0/gnuplot.pdf) (pp. 80-102). Options are
73-
passed to Dataset.new as hash and are tranlated into gnuplot format before
74-
plotting:
75-
Dataset.new(data, with: 'lines', using: '1:2')
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+
```
7662

7763
Examples of option translation (nested containers allowed):
78-
* Hash:
79-
{ key1: "value1", key2: { nested_key1: "nested_value1" } }
80-
# =>
81-
"key1 value1 key2 nested key1 nested_value1"
82-
83-
* Hashes with underscored keys (see
84-
[#7](https://github.com/dilcom/gnuplotrb/issues/7)):
85-
{ style_data: 'histograms' }
86-
#=>
87-
"style data histograms"
88-
89-
* Range:
90-
{ xrange: 0..100 }
91-
# =>
92-
"xrange [0:100]"
93-
94-
* Array (often used with nested hashes) and Array of Numeric
95-
['png', { size: [400, 500] }]
96-
# =>
97-
"png size 400,500"
98-
99-
* Others
100-
some_object
101-
# =>
102-
some_object.to_s
103-
104-
105-
Once Dataset created, it may be updated with new data or options. Methods
106-
related to updating are explained in [a
107-
notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/not
108-
ebooks/updating_data.ipynb).
109-
110-
Just as other Plottable object Dataset has several plotting methods which are
111-
desribed in [beginners
112-
notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/not
113-
ebooks/basic_usage.ipynb).
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).
11498

11599
#### Plot
116100
Plot is a container for several datasets and layout options:
117-
Plot.new(ds1, ds2, ds2, xrange: 1..10)
101+
```ruby
102+
Plot.new(ds1, ds2, ds2, xrange: 1..10)
103+
```
118104

119105
Datasets contained bu Plot are outputted on single xy plain.
120106

121-
Plot's options are explained in [gnuplot
122-
doc](http://www.gnuplot.info/docs_5.0/gnuplot.pdf) (pp. 105-181). Plot options
123-
are translated into gnuplot format the same way as Dataset's (except adding
124-
'set' before each option). Plot's datasets and Plot itself may be updated with
125-
almost the same methods as desribed in Dataset section above.
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.
126108

127109
#### Splot
128110
Almost the same as Plot but for 3-D plots. See Plot section.
129111

130112
#### Multiplot
131113

132-
Container for several Plot or Splot objects, each of them is plotted in its
133-
own xy(z) space. So Multiplot offers single layout (image filewindow) for
134-
several plots. It's grid is tuned by :layout option, and you can also set
135-
layout's title:
136-
Multiplot.new(plot1, plot2, splot1, layout: [3, 1], title: 'Three plots on a layout')
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+
```
137118

138-
Updating methods for Multiplot are almost the same as Plot's and Dataset's and
139-
are covered in Multiplot's docs and [multiplot
140-
notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/not
141-
ebooks/multiplot_layout.ipynb). See examples there.
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.
142120

143121
#### Animation
144122

145-
Animation is a container for several Plot, Splot or Multiplot objects. Each of
146-
contained items is considered as frame in gif animation which is creating by
147-
```#plot``` call. Animation's frames and options may be modifyed or updated
148-
just as other classes above. Animation does not support methods like
149-
```#to_png``` and may be plotted only with ```#plot``` method. Please see
150-
[related
151-
notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/not
152-
ebooks/animated_plots.ipynb) and docs at RubyDoc for examples.
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.
153124

154125
### Notebooks
155126

156-
This notebooks are powered by [Ruby kernel](https://github.com/SciRuby/iruby/)
157-
for [IPython/Jupyter](https://jupyter.org/). I placed them here to show some
158-
GnuplotRB's capabilities and ways of using it together with iRuby.
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.
159128

160129
To use GnuplotRB gem with iRuby you need to install them both.
161130

162-
* iRuby installation is covered in its
163-
[README](https://github.com/SciRuby/iruby/blob/master/README.md). It also
164-
covers installation of iPython and other dependecies.
165-
* GnuplotRB gem installation covered in
166-
[README](https://github.com/sciruby/gnuplotrb#installation) too.
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.
167133

168134

169135
#### Embedding plots into iRuby
170136
Using GnuplotRB inside iRuby notebooks is covered in:
171137

172-
* [Basic usage
173-
notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master
174-
/notebooks/basic_usage.ipynb).
175-
138+
* [Basic usage notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/basic_usage.ipynb).
176139

177140
#### 2D and 3D plots
178141
GnuplotRB is capable to plot vast range of plots from histograms to 3D
179142
heatmaps. Gem's repository contains examples of several plot types:
180143

181-
* [Heatmaps](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/maste
182-
r/notebooks/heatmaps.ipynb)
183-
* [Vector
184-
field](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/no
185-
tebooks/vector_field.ipynb) (Thanks, [Alexej](https://github.com/agisga))
186-
* [Math
187-
equations](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/maste
188-
r/notebooks/math_plots.ipynb)
189-
* [3D
190-
visualizations](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/
191-
master/notebooks/3d_plot.ipynb)
192-
* [Histogram](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/mast
193-
er/notebooks/histogram.ipynb)
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)
194149

195150

196151
#### Possible datasources
197152
GnuplotRB may take data in Ruby container or in a file. Supported containers
198-
for now are Arrays, Daru::Vector and Daru::DataFrame. When data given in file,
153+
for now are `Array`, `Daru::Vector` and `Daru::DataFrame`. When data given in file,
199154
GnuplotRB pass filename to Gnuplot **without** reading the file into memory.
200155

201156
Examples of using different datasources:
202157

203-
* [Data given in file or Ruby
204-
Array](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/no
205-
tebooks/points_from_different_sources.ipynb)
206-
* [Data given in Daru
207-
containers](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/mast
208-
er/notebooks/plotting_from_daru.ipynb)
209-
* [Data given in Daru containers (with
210-
timeseries)](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/mas
211-
ter/notebooks/time_series_from_daru.ipynb)
212-
* [Updating plots with new
213-
data](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/not
214-
ebooks/updating_data.ipynb)
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)
215162

216163

217164
#### Multiplot
218165
You can not only plot several datasets in single coordinate system but place
219166
several coordinate systems on a canvas.
220167

221-
* [Multiplot example
222-
notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master
223-
/notebooks/multiplot_layout.ipynb).
224-
168+
* [Multiplot example notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/multiplot_layout.ipynb).
225169

226170
#### Animation
227-
It's possible to use several plots (Plot, Splot or Multiplot objects) to
228-
create gif animation.
171+
It's possible to use several plots (Plot, Splot or Multiplot objects) to create gif animation.
229172

230-
* [Animation example
231-
notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master
232-
/notebooks/animated_plots.ipynb).
173+
* [Animation example notebook](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/animated_plots.ipynb).
233174

234175

235176
#### Fitting data with formula
236177
GnuplotRB also may be used to fit some data with given math formula.
237178

238-
* [Fitting
239-
data](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/not
240-
ebooks/fitting_data.ipynb)
179+
* [Fitting data](http://nbviewer.ipython.org/github/sciruby/gnuplotrb/blob/master/notebooks/fitting_data.ipynb)
241180

242181

243182
### Plain examples
244-
You may find several examples in [examples
245-
directory](https://github.com/sciruby/gnuplotrb/tree/master/examples).
183+
You may find several examples in [examples directory](https://github.com/sciruby/gnuplotrb/tree/master/examples).
246184

247185
## Contributing
248186

0 commit comments

Comments
 (0)