abstract class Ishi::Base

Overview

Supported methods.

Direct Known Subclasses

Defined in:

ishi/base.cr

Instance Method Summary

Instance Method Detail

def boxwidth(boxwidth : Float64) #

Sets the default width of boxes in the boxes, boxerrorbars, candlesticks and histograms styles.

For information on setting the box width, see: Boxwidth.


[View source]
def canvas_size(width : Float64, height : Float64) #

Sets the size of the terminal canvas.


[View source]
def canvas_size(width : Int32, height : Int32) #

Sets the size of the terminal canvas.


[View source]
def charts(rows : Int32, cols : Int32) #

Changes the number of charts in the figure.

By default a figure has one chart. This call changes the number of charts in the figure. The original chart is preserved and becomes the chart in the first row, first column of the new layout.

Returns the charts.

figure = Ishi.new
charts = figure.charts(2, 2)
charts[0].plot([1, 2, 3, 4])
charts[1].plot([2, 3, 4, 1])
  ...
figure.show

[View source]
def charts(rows : Int32, cols : Int32, &) #

Changes the number of charts in the figure.

By default a figure has one chart. This call changes the number of charts in the figure. The original chart is preserved and becomes the chart in the first row, first column of the new layout.

Yields each chart as the default receiver of the supplied block. Block arguments are i (the i-th chart in the figure), row and col (the row and column of the chart).

figure = Ishi.new
figure.charts(2, 2) do |i|
  plot([1, 2, 3, 4].rotate(i))
    ...
end
figure.show

[View source]
def imshow(data : Indexable(Indexable(D)), **options) forall D #

Displays an image.

data is scalar image data.

Data is visualized using a colormap.


[View source]
def margin(left : Float64 | Bool = false, right : Float64 | Bool = false, top : Float64 | Bool = false, bottom : Float64 | Bool = false) #

Sets the margin.

For information on setting/unsetting the margin, see: Margin.


[View source]
def margin(left : Int32 | Bool = false, right : Int32 | Bool = false, top : Int32 | Bool = false, bottom : Int32 | Bool = false) #

Sets the margin.

For information on setting/unsetting the margin, see: Margin.


[View source]
def palette(name : Symbol, colorbox : Bool = true) #

Sets the palette.

name is :gray or one of the available color palettes: :hot, :inferno, :jet, :magma, :plasma or :viridis

Optionally, shows/hides the chart colorbox based on the value of colorbox.


[View source]
def plot(xdata : Indexable(T), ydata : Indexable(U), zdata : Indexable(V), format : String | Nil = nil, *, title : String | Nil = nil, style : Symbol = :points, **options) forall T, U, V #

Plots x, y and z.

title is the title of the plot. style is the drawing style. Supported styles include :surface, :circles, :lines, :points and :dots.


[View source]
def plot(ydata : Indexable(Y), format : String | Nil = nil, *, title : String | Nil = nil, style : Symbol = :lines, **options) forall Y #

Plots y using x ranging from 0 to N-1.

title is the title of the plot. style is the drawing style. Supported styles include :boxes, :lines, :points, :linespoints and :dots.


[View source]
def plot(xdata : Indexable(M), ydata : Indexable(N), format : String | Nil = nil, *, title : String | Nil = nil, style : Symbol = :points, **options) forall M, N #

Plots x and y.

title is the title of the plot. style is the drawing style. Supported styles include :boxes, :lines, :points, :linespoints and :dots.


[View source]
def plot(expression : String, format : String | Nil = nil, *, title : String | Nil = nil, style : Symbol | Nil = nil, **options) #

Plots a mathematical expression.

plot("sin(x) * cos(x)")
plot("3.5 * x + 1.5")

For information on gnuplot mathematical expressions, see: Expressions.

title is the title of the plot. style is the drawing style. Supported styles include :lines and :points.


[View source]
def scatter(xdata : Indexable(M), ydata : Indexable(N), format : String | Nil = nil, *, title : String | Nil = nil, style : Symbol = :dots, **options) forall M, N #

Scatter plots x and y.

title is the title of the plot.


[View source]
def scatter(xdata : Indexable(T), ydata : Indexable(U), zdata : Indexable(V), format : String | Nil = nil, *, title : String | Nil = nil, style : Symbol = :dots, **options) forall T, U, V #

Scatter plots x, y and z.

title is the title of the plot.


[View source]
abstract def show(**options) #

Shows the chart(s).


[View source]
def show_border(show : Bool) #

Shows/hides the chart border.

For information on setting/unsetting the border, see: Border.


[View source]
def show_colorbox(show : Bool) #

Shows/hides the chart colorbox.

For information on setting/unsetting the colorbox, see: Colorbox.


[View source]
def show_key(show : Bool) #

Shows/hides the chart key.

For information on setting/unsetting the key, see: Key.


[View source]
def show_xtics(show : Bool) #

Shows/hides the chart xtics.

For information on setting/unsetting the xtics, see: Xtics.


[View source]
def show_ytics(show : Bool) #

Shows/hides the chart ytics.

For information on setting/unsetting the ytics, see: Ytics.


[View source]
def size #

Returns the number of charts in the figure.


[View source]
def view(xrot : Float64, zrot : Float64) #

Sets the viewing angle for 3D charts.

For information on setting the viewing angle, see: View.


[View source]
def view(xrot : Int32, zrot : Int32) #

Sets the viewing angle for 3D charts.

For information on setting the viewing angle, see: View.


[View source]
def xlabel(xlabel : String) #

Sets the label of the x axis.


[View source]
def xrange(xrange : Range(Float64, Float64) | Range(Int32, Int32)) #

Sets the range of the x axis.


[View source]
def xtics(xtics : Hash(Float64, String)) #

Sets non-numeric labels on the x-axis.

This translates to set xtics ({"<label>"} <pos> {<level>} {,{"<label>"}...})

see: Xtics list

Example:

plot(x, y).xtics({1.0 => "Jan", 6.0 => "Jun", 12.0 => "Dec"})

[View source]
def ylabel(ylabel : String) #

Sets the label of the y axis.


[View source]
def yrange(yrange : Range(Float64, Float64) | Range(Int32, Int32)) #

Sets the range of the y axis.


[View source]
def zlabel(zlabel : String) #

Sets the label of the z axis.


[View source]
def zrange(zrange : Range(Float64, Float64) | Range(Int32, Int32)) #

Sets the range of the z axis.


[View source]