Skip to content

Commit 9f02576

Browse files
committed
update readme
1 parent ef32541 commit 9f02576

File tree

1 file changed

+60
-3
lines changed

1 file changed

+60
-3
lines changed

README.rdoc

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
GnuplotRB is a plot generator for Ruby based on {Gnuplot}[http://www.gnuplot.info].
44

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://dilcom.github.io/gnuplotrb/].
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/].
66

77
{<img src="https://badge.fury.io/rb/gnuplotrb.svg" alt="Gem Version" />}[https://rubygems.org/gems/gnuplotrb]
88

@@ -14,7 +14,8 @@ This software has been developed as a product in Google Summer of Code 2015 (GSo
1414

1515
== Table of contents
1616
* {Installation}[https://github.com/dilcom/gnuplotrb#installation]
17-
* {Examples}[https://github.com/dilcom/gnuplotrb#examples]
17+
* {Getting started}[https://github.com/dilcom/gnuplotrb#getting-started]
18+
* {Plottable classes}[https://github.com/dilcom/gnuplotrb#plottable-classes]
1819
* {Notebooks}[https://github.com/dilcom/gnuplotrb#notebooks]
1920
* {Plain examples}[https://github.com/dilcom/gnuplotrb#plain-examples]
2021
* {Contributing}[https://github.com/dilcom/gnuplotrb#contributing]
@@ -38,7 +39,63 @@ This software has been developed as a product in Google Summer of Code 2015 (GSo
3839
bundle install
3940
rake install
4041

41-
== Examples
42+
== Getting started
43+
44+
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.
45+
46+
=== Plottable classes
47+
48+
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 notebook}[http://nbviewer.ipython.org/github/dilcom/gnuplotrb/blob/master/notebooks/basic_usage.ipynb].
49+
50+
==== Dataset
51+
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/dilcom/gnuplotrb#possible-datasources].
52+
53+
Dataset have several possible options which are explained in {gnuplot 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:
54+
Dataset.new(data, with: 'lines', using: '1:2')
55+
Examples of option translation (nested containers allowed):
56+
* Hash:
57+
{ key1: "value1", key2: { nested_key1: "nested_value1" } }
58+
# =>
59+
"key1 value1 key2 nested key1 nested_value1"
60+
* Range:
61+
{ xrange: 0..100 }
62+
# =>
63+
"xrange [0:100]"
64+
* Array (often used with nested hashes) and Array of Numeric
65+
['png', { size: [400, 500] }]
66+
# =>
67+
"png size 400,500"
68+
* Others
69+
some_object
70+
# =>
71+
some_object.to_s
72+
73+
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/dilcom/gnuplotrb/blob/master/notebooks/updating_data.ipynb].
74+
75+
Just as other Plottable object Dataset has several plotting methods which are desribed in {beginners notebook}[http://nbviewer.ipython.org/github/dilcom/gnuplotrb/blob/master/notebooks/basic_usage.ipynb].
76+
77+
==== Plot
78+
Plot is a container for several datasets and layout options:
79+
Plot.new(ds1, ds2, ds2, xrange: 1..10)
80+
81+
Datasets contained bu Plot are outputted on single xy plain.
82+
83+
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.
84+
85+
==== Splot
86+
Almost the same as Plot but for 3-D plots. See Plot section.
87+
88+
==== Multiplot
89+
90+
Container for several Plot or Splot objects, each of them is plotted in its own xy(z) space. So Multiplot offers single layout (image file\window) for several plots. It's grid is tuned by :layout option, and you can also set layout's title:
91+
Multiplot.new(plot1, plot2, splot1, layout: [3, 1], title: 'Three plots on a layout')
92+
93+
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/dilcom/gnuplotrb/blob/master/notebooks/multiplot_layout.ipynb]. See examples there.
94+
95+
==== Animation
96+
97+
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/dilcom/gnuplotrb/blob/master/notebooks/animated_plots.ipynb] and docs at RubyDoc for examples.
98+
4299
=== Notebooks
43100

44101
This notebooks are powered by {Ruby kernel}[https://github.com/SciRuby/iruby/] for {IPython/Jupyter}[https://jupyter.org/].

0 commit comments

Comments
 (0)