Skip to content

Commit 98404d6

Browse files
committed
Add lineplot document
1 parent 87122fa commit 98404d6

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

lib/unicode_plot/lineplot.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,32 @@ module UnicodePlot
44
class Lineplot < GridPlot
55
end
66

7+
# @overload lineplot([x], y, name: "", canvas: :braille, title: "", xlabel: "", ylabel: "", labels: true, border: :solid, margin: Plot::DEFAULT_MARGIN, padding: Plot::DEFAULT_PADDING, color: :auto, width: Plot::DEFAULT_WIDTH, height: GridPlot::DEFAULT_HEIGHT, xlim: [0, 0], ylim: [0, 0], canvas: :braille, grid: true)
8+
#
9+
# Draws a path through the given points on a new canvas.
10+
#
11+
# The first (optional) array `x` should contain the horizontal positions for all the points along the path.
12+
# The second array `y` should then contain the corresponding vertical positions respectively.
13+
# This means that the two vectors must be of the same length and ordering.
14+
#
15+
# @param x [Array<Numeric>] Optional. The horizontal position for each point. If omitted, the axes of `y` will be used as `x`.
16+
# @param y [Array<Numeric>] The vertical position for each point.
17+
# @param name [String] Annotation of the current drawing to be displayed on the right.
18+
# @param title
19+
# @param xlabel
20+
# @param ylabel
21+
# @param labels
22+
# @param border
23+
# @param margin
24+
# @param padding
25+
# @param color
26+
# @param width
27+
# @param height
28+
# @param xlim
29+
# @param ylim
30+
# @param canvas [Symbol] The type of canvas that should be used for drawing.
31+
# @param grid [true,false] If `true`, draws grid-lines at the origin.
32+
# @return [Lineplot] A plot object.
733
module_function def lineplot(*args,
834
canvas: :braille,
935
color: :auto,
@@ -41,6 +67,16 @@ class Lineplot < GridPlot
4167
end
4268
end
4369

70+
# @overload lineplot!(plot, [x], y, name: "", color: :auto)
71+
#
72+
# Draws a path through the given points on the given canvas.
73+
#
74+
# @param plot [Lineplot] The plot object.
75+
# @param x [Array<Numeric>] Optional. The horizontal position for each point. If omitted, the axes of `y` will be used as `x`.
76+
# @param y [Array<Numeric>] The vertical position for each point.
77+
# @param name [String] Annotation of the current drawing to be displayed on the right.
78+
# @param color
79+
# @return [Lineplot] The plot object same as the `plot` parameter.
4480
module_function def lineplot!(plot,
4581
*args,
4682
color: :auto,

0 commit comments

Comments
 (0)