Skip to content

Commit d1d1f29

Browse files
committed
add docs to plot
1 parent c30f535 commit d1d1f29

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

lib/gnuplotrb/plot.rb

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,39 @@
11
module GnuplotRB
22
##
33
# === Overview
4-
# Plot correspond to simple 2D visualisation
4+
# Class corresponding to simple 2D visualisation.
5+
#
6+
# === Notebooks
7+
#
8+
# * {Heatmaps}[http://nbviewer.ipython.org/github/dilcom/gnuplotrb/blob/master/notebooks/heatmaps.ipynb]
9+
# * {Vector field}[http://nbviewer.ipython.org/github/dilcom/gnuplotrb/blob/master/notebooks/vector_field.ipynb]
10+
# * {Math equations}[http://nbviewer.ipython.org/github/dilcom/gnuplotrb/blob/master/notebooks/math_plots.ipynb]
11+
# * {Histogram}[http://nbviewer.ipython.org/github/dilcom/gnuplotrb/blob/master/notebooks/histogram.ipynb]
12+
# * {Updating plots with new data}[http://nbviewer.ipython.org/github/dilcom/gnuplotrb/blob/master/notebooks/updating_data.ipynb]
13+
#
14+
# === Options
15+
# All possible options are exaplained in
16+
# {gnuplot docs}[http://www.gnuplot.info/docs_5.0/gnuplot.pdf](pp. 105-190).
17+
# Several common ones:
18+
# * xrange(yrange, zrange, urange, vrange) - set range for a variable. Takes
19+
# Range (xrange: 0..100), or String (yrange: '[0:100]').
20+
# * title - plot's title. Takes String (title: 'Some new plot').
21+
# * polar (parametric) - plot in polar or parametric space. Takes boolean (true).
22+
# * using - choose which columns of input data gnuplot should use. Takes String
23+
# (using: 'xtic(1):2:3'). If Daru::Dataframe passed one can use column names
24+
# instead of numbers (using: 'index:value1:summ' - value1 and summ here are column names).
25+
# * style_data - set style for plotting data. Takes string, possible values: histogram,
26+
# points, lines, linespoints, boxes etc. See gnuplot docs for more.
27+
# * term - select terminal used by gnuplot. Examples: { term: 'png' },
28+
# { term: ['svg', size: [600, 600]] }. Deprecated due to existance of #to_<term_name> methods.
29+
# One can use #to_png and #to_svg(size: [600, 600]) instead of passing previous options.
30+
# * output - select filename to output plot to. Should be used together with term. Deprecated
31+
# due to existance of #to_<term_name> methods. One should use #to_png('file.png') instead of
32+
# passing { term: 'png', output: 'file.png' }.
33+
# Every option may be passed to constructor in order to create plot with it.
34+
# Methods #options(several: options, ...) and bunch of #option_name(only_an: option) such as
35+
# #xrange, #using, #polar etc create new Plot object based on existing but with a new options.
36+
# See notebooks for examples.
537
class Plot
638
include Plottable
739
##
@@ -13,7 +45,7 @@ class Plot
1345
# [data, **dataset_options] arrays from which Dataset may be created
1446
# * *options* will be considered as 'settable' options of gnuplot
1547
# ('set xrange [1:10]' for { xrange: 1..10 },
16-
# "set title 'plot'" for { title: 'plot' } etc)
48+
# "set title 'plot'" for { title: 'plot' } etc).
1749
def initialize(*datasets)
1850
# had to relace **options arg with this because in some cases
1951
# Daru::DataFrame was mentioned as hash and added to options
@@ -33,7 +65,7 @@ def initialize(*datasets)
3365
# ====== Overview
3466
# This outputs plot to term (if given) or to this plot's own terminal.
3567
# ====== Arguments
36-
# * *term* - Terminal to plot to
68+
# * *term* - Terminal object to plot to
3769
# * *multiplot_part* - part of a multiplot. Option for inner usage
3870
# * *options* - will be considered as 'settable' options of gnuplot
3971
# ('set xrange [1:10]', 'set title 'plot'' etc)

0 commit comments

Comments
 (0)