module UnicodePlot

Extended Modules

Defined in:

unicode_plot.cr
unicode_plot/canvas.cr
unicode_plot/canvas/ascii_canvas.cr
unicode_plot/canvas/block_canvas.cr
unicode_plot/canvas/braille_canvas.cr
unicode_plot/canvas/density_canvas.cr
unicode_plot/canvas/dot_canvas.cr
unicode_plot/color.cr
unicode_plot/common.cr
unicode_plot/graphics.cr
unicode_plot/graphics/bar_graphics.cr
unicode_plot/graphics/boxplot_graphics.cr
unicode_plot/graphics/heatmap_graphics.cr
unicode_plot/interface/barplot.cr
unicode_plot/interface/boxplot.cr
unicode_plot/interface/densityplot.cr
unicode_plot/interface/heatmap.cr
unicode_plot/interface/histogram.cr
unicode_plot/interface/lineplot.cr
unicode_plot/interface/scatterplot.cr
unicode_plot/interface/stairs.cr
unicode_plot/plot.cr
unicode_plot/show.cr

Constant Summary

ANSI_RESET = "\e[0m"
ASCII_DECODE_512 = begin table = Array(Char).new(512, ' ') sorted_lookup = ASCII_LOOKUP_MAP.to_a.sort_by do |k, _v| k end (0_u32...512_u32).each do |pattern| if pattern == 0 table[pattern] = ' ' elsif ASCII_LOOKUP_MAP.has_key?(pattern) table[pattern] = ASCII_LOOKUP_MAP[pattern] else best_char = ' ' best_dist = Int32::MAX sorted_lookup.each do |__temp_94| k, v = __temp_94 dist = 0 x = pattern ^ k while x != 0 if (x & 1) != 0 dist = dist + 1 end x = x >> 1 end if dist < best_dist best_dist = dist best_char = v end end table[pattern] = best_char end end table end

Full 512-entry decode table built at startup. For unmapped patterns, the closest entry by Hamming distance is used.

ASCII_LOOKUP_MAP = {320_u32 => '"', 511_u32 => '@', 128_u32 => '\'', 162_u32 => '(', 138_u32 => ')', 16_u32 => '*', 186_u32 => '+', 18_u32 => ',', 36_u32 => ',', 9_u32 => ',', 56_u32 => '-', 2_u32 => '.', 4_u32 => '.', 1_u32 => '.', 84_u32 => '/', 160_u32 => '/', 86_u32 => '/', 210_u32 => '/', 82_u32 => '/', 407_u32 => '1', 130_u32 => ':', 455_u32 => '=', 471_u32 => 'I', 295_u32 => 'L', 466_u32 => 'T', 362_u32 => 'V', 341_u32 => 'X', 338_u32 => 'Y', 422_u32 => '[', 136_u32 => '\\', 273_u32 => '\\', 402_u32 => '\\', 275_u32 => '\\', 274_u32 => '\\', 203_u32 => ']', 168_u32 => '^', 7_u32 => '_', 256_u32 => '`', 403_u32 => 'l', 60_u32 => 'r', 42_u32 => 'v', 243_u32 => '{', 146_u32 => '|', 292_u32 => '|', 73_u32 => '|', 414_u32 => '}'}

Exact 9-bit → character mappings from Julia's ASCII_LOOKUP.

ASCII_SIGNS_3X3 = [[256_u32, 128_u32, 64_u32], [32_u32, 16_u32, 8_u32], [4_u32, 2_u32, 1_u32]]

3×3 pixel grid per character cell — 9-bit pattern per cell (bit 8 = top-left). Matches Julia UnicodePlots AsciiCanvas (y_pixel_per_char=3, x_pixel_per_char=3).

BASES = {:identity => nil, :ln => "ℯ", :sqrt => nil, :log2 => "2", :log10 => "10"}
BLANK = 32_u32
BLANK_BRAILLE = 10240_u32
BLOCK_DECODE = [' ', '▗', '▖', '▄', '▝', '▐', '▞', '▟', '▘', '▚', '▌', '▙', '▀', '▜', '▛', '█']
BLOCK_SIGNS = [[8_u32, 4_u32], [2_u32, 1_u32]]

2×2 pixel per character, encoded with block drawing characters.

BORDER_ASCII = Border.new('+', '+', '+', '+', '-', '|', '-', '|')
BORDER_BARPLOT = Border.new('┌', '┐', '└', '┘', ' ', '┤', ' ', ' ')
BORDER_BNONE = Border.new('⠀', '⠀', '⠀', '⠀', '⠀', '⠀', '⠀', '⠀')
BORDER_BOLD = Border.new('┏', '┓', '┗', '┛', '━', '┃', '━', '┃')
BORDER_CORNERS = Border.new('┌', '┐', '└', '┘', ' ', ' ', ' ', ' ')
BORDER_DASHED = Border.new('┌', '┐', '└', '┘', '╌', '┊', '╌', '┊')
BORDER_DOTTED = Border.new('⡤', '⢤', '⠓', '⠚', '⠤', '⡇', '⠒', '⢸')
BORDER_NONE = Border.new(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ')
BORDER_SOLID = Border.new('┌', '┐', '└', '┘', '─', '│', '─', '│')
BORDERMAP = {:solid => BORDER_SOLID, :corners => BORDER_CORNERS, :barplot => BORDER_BARPLOT, :bold => BORDER_BOLD, :none => BORDER_NONE, :bnone => BORDER_BNONE, :dashed => BORDER_DASHED, :dotted => BORDER_DOTTED, :ascii => BORDER_ASCII}
BRAILLE_SIGNS = [[1_u32, 8_u32], [2_u32, 16_u32], [4_u32, 32_u32], [64_u32, 128_u32]]

Braille dot offsets within a 4×2 pixel cell. Index: [pixel_row_offset][pixel_col_offset] (1-based)

COLOR_CYCLE_BRIGHT = [:light_green, :light_blue, :light_red, :light_magenta, :light_yellow, :light_cyan]
COLOR_CYCLE_FAINT = [:green, :blue, :red, :magenta, :yellow, :cyan]
COLORMAP_STOPS = {:viridis => [{0.00, 68, 1, 84}, {0.25, 59, 82, 139}, {0.50, 33, 145, 140}, {0.75, 94, 201, 98}, {1.00, 253, 231, 37}], :plasma => [{0.00, 13, 8, 135}, {0.25, 126, 3, 167}, {0.50, 203, 71, 120}, {0.75, 248, 149, 64}, {1.00, 240, 249, 33}], :inferno => [{0.00, 0, 0, 4}, {0.25, 87, 16, 110}, {0.50, 188, 55, 84}, {0.75, 249, 142, 9}, {1.00, 252, 255, 164}], :magma => [{0.00, 0, 0, 4}, {0.25, 81, 18, 124}, {0.50, 183, 55, 121}, {0.75, 252, 137, 97}, {1.00, 252, 253, 191}], :cividis => [{0.00, 0, 32, 76}, {0.25, 50, 82, 130}, {0.50, 119, 136, 138}, {0.75, 181, 188, 101}, {1.00, 254, 233, 55}], :gray => [{0.00, 0, 0, 0}, {1.00, 255, 255, 255}]}

Multi-stop colormap: each stop is {t, r, g, b} with t in [0,1].

DENSITY_CHARS = [' ', '░', '▒', '▓', '█']
FSCALES = {:identity => ->(x : Float64) do x end, :ln => ->(x : Float64) do Math.log(x) end, :sqrt => ->(x : Float64) do Math.sqrt(x) end, :log2 => ->(x : Float64) do Math.log2(x) end, :log10 => ->(x : Float64) do Math.log10(x) end}
FULL_BLOCK = '█'
FULL_BRAILLE = 10495_u32
HALF_BLOCK = '▄'
HEATMAP_ASPECT_RATIO = 4.0 / 3.0
INVALID_COLOR = UInt32::MAX
ISCALES = {:identity => ->(x : Float64) do x end, :ln => ->(x : Float64) do Math::E ** x end, :sqrt => ->(x : Float64) do x ** 2 end, :log2 => ->(x : Float64) do 2.0 ** x end, :log10 => ->(x : Float64) do 10.0 ** x end}
MARKERS = {:circle => '⚬', :rect => '▫', :diamond => '◇', :hexagon => '⬡', :cross => '✚', :xcross => '✖', :utriangle => '△', :dtriangle => '▽', :rtriangle => '▷', :ltriangle => '◁', :pentagon => '⬠', :star4 => '✦', :star5 => '★', :star6 => '✶', :star8 => '✴', :vline => '|', :hline => '―', :plus => '+', :x => '⨯'}
NAMED_COLORS = {:black => 0_u32, :red => 1_u32, :green => 2_u32, :yellow => 3_u32, :blue => 4_u32, :magenta => 5_u32, :cyan => 6_u32, :white => 7_u32, :dark_gray => 8_u32, :light_red => 9_u32, :light_green => 10_u32, :light_yellow => 11_u32, :light_blue => 12_u32, :light_magenta => 13_u32, :light_cyan => 14_u32, :light_white => 15_u32}

Named ANSI 4-bit colors → 256-color palette index (stored as THRESHOLD + idx)

SUPERSCRIPT = {'.' => '⸱', '-' => '⁻', '+' => '⁺', '0' => '⁰', '1' => '¹', '2' => '²', '3' => '³', '4' => '⁴', '5' => '⁵', '6' => '⁶', '7' => '⁷', '8' => '⁸', '9' => '⁹', 'e' => 'ᵉ'}
THRESHOLD = 256_u32 ** 3
VERSION = "0.1.0"
WIDTH_CB = 4

Instance Method Summary

Instance Method Detail

def ansi_bg_escape(color : UInt32) : String #

ANSI escape for background color


[View source]
def ansi_color(r : Int32, g : Int32, b : Int32) : UInt32 #

[View source]
def ansi_color(color : Symbol) : UInt32 #

Convert a color symbol/int/tuple to internal ColorType (UInt32)


[View source]
def ansi_color(color : Int32) : UInt32 #

[View source]
def ansi_color(color : UInt32) : UInt32 #

[View source]
def ansi_color(color : Nil) : UInt32 #

[View source]
def ansi_color(rgb : Tuple(Int32, Int32, Int32)) : UInt32 #

[View source]
def ansi_fg_escape(color : UInt32) : String #

ANSI escape for foreground color


[View source]
def aspect_ratio : Float64 #

[View source]
def b32(b : UInt32) : UInt32 #

[View source]
def barplot(text : Array(String), heights : Array(Float64), *, color : Symbol | Int32 | Tuple(Int32, Int32, Int32) | Array(Symbol) | Array(Int32) | Array(UInt32) | UInt32 = :green, width : Int32 | Nil = nil, xscale : Symbol | Proc(Float64, Float64) = :identity, name : String = "", symbols : Array(Char) = ['■'], maximum : Float64 | Nil = nil, xlabel : String = "", border : Symbol = :barplot, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, unicode_exponent : Bool = true, thousands_separator : Char = ' ', compact_labels : Bool = false, compact : Bool = false, title : String = "") : Plot #

[View source]
def barplot(text : Array(String), heights : Array(Int32), **kwargs) : Plot #

[View source]
def barplot(text : Array(String), heights : Array(Number), **kwargs) : Plot #

[View source]
def barplot(dict : Hash(String, Float64), **kwargs) : Plot #

[View source]
def barplot(dict : Hash(String, Number), **kwargs) : Plot #

[View source]
def barplot!(plot : Plot, text : Array(String), heights : Array(Float64), *, color : Symbol | Int32 | UInt32 | Tuple(Int32, Int32, Int32) | Nil = nil, name : String = "") : Plot #

[View source]
def barplot!(plot : Plot, text : Array(String), heights : Array(Number), **kwargs) : Plot #

[View source]
def barplot!(plot : Plot, label : String, height : Float64, **kwargs) : Plot #

[View source]
def blend_colors(a : UInt32, b : UInt32) : UInt32 #

Blend two ColorType values


[View source]
def blu(c : UInt32) : UInt8 #

[View source]
def border_color : Symbol #

[View source]
def boxplot(names : Array(String), data : Array(Array(Float64)), *, color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) | Array(Symbol) | Array(UInt32) = :green, title : String = "", xlabel : String = "", xlim : Tuple(Float64, Float64) = {0.0, 0.0}, border : Symbol = :corners, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, unicode_exponent : Bool = true, thousands_separator : Char = ' ', compact_labels : Bool = false, compact : Bool = false, width : Int32 | Nil = nil) : Plot #

[View source]
def boxplot(name : String, data : Array(Float64), *, color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :green, title : String = "", xlabel : String = "", xlim : Tuple(Float64, Float64) = {0.0, 0.0}, border : Symbol = :corners, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, unicode_exponent : Bool = true, thousands_separator : Char = ' ', compact_labels : Bool = false, compact : Bool = false, width : Int32 | Nil = nil) : Plot #

[View source]
def boxplot(names : Array(String), data : Array(Array(Number)), **kwargs) : Plot #

[View source]
def boxplot(name : String, data : Array(Number), **kwargs) : Plot #

[View source]
def boxplot(data : Array(Array(Float64)), *, names : Array(String) = [] of String, color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) | Array(Symbol) | Array(UInt32) = :green, title : String = "", xlabel : String = "", xlim : Tuple(Float64, Float64) = {0.0, 0.0}, border : Symbol = :corners, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, unicode_exponent : Bool = true, thousands_separator : Char = ' ', compact_labels : Bool = false, compact : Bool = false, width : Int32 | Nil = nil) : Plot #

[View source]
def boxplot(data : Array(Float64), *, name : String = "", color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :green, title : String = "", xlabel : String = "", xlim : Tuple(Float64, Float64) = {0.0, 0.0}, border : Symbol = :corners, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, unicode_exponent : Bool = true, thousands_separator : Char = ' ', compact_labels : Bool = false, compact : Bool = false, width : Int32 | Nil = nil) : Plot #

[View source]
def boxplot(dict : Hash(String, Array(Float64)), *, color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) | Array(Symbol) | Array(UInt32) = :green, title : String = "", xlabel : String = "", border : Symbol = :corners, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, unicode_exponent : Bool = true, thousands_separator : Char = ' ', compact_labels : Bool = false, compact : Bool = false, width : Int32 | Nil = nil) : Plot #

[View source]
def boxplot(dict : Hash(String, Array(Number)), *, color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) | Array(Symbol) | Array(UInt32) = :green, title : String = "", xlabel : String = "", border : Symbol = :corners, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, unicode_exponent : Bool = true, thousands_separator : Char = ' ', compact_labels : Bool = false, compact : Bool = false, width : Int32 | Nil = nil) : Plot #

[View source]
def boxplot(data : Array(Number), **kwargs) : Plot #

[View source]
def boxplot!(plot : Plot, name : String, data : Array(Float64), *, color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :auto) : Plot #

[View source]
def boxplot!(plot : Plot, name : String, data : Array(Number), **kwargs) : Plot #

[View source]
def boxplot!(plot : Plot, data : Array(Float64), *, name : String = "", color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :auto) : Plot #

[View source]
def boxplot!(plot : Plot, data : Array(Number), **kwargs) : Plot #

[View source]
def build_plot(x : Array(Float64), y : Array(Float64), *, canvas_type : Symbol = :braille, title : String = "", xlabel : String = "", ylabel : String = "", xscale : Symbol | Proc(Float64, Float64) = :identity, yscale : Symbol | Proc(Float64, Float64) = :identity, height : Int32 | Nil = nil, width : Int32 | Nil = nil, border : Symbol = :solid, compact_labels : Bool = false, compact : Bool = false, blend : Bool = true, xlim : Tuple(Float64, Float64) = {0.0, 0.0}, ylim : Tuple(Float64, Float64) = {0.0, 0.0}, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, grid : Bool = true, yticks : Bool = true, xticks : Bool = true, min_height : Int32 = 2, min_width : Int32 = 5, yflip : Bool = false, xflip : Bool = false, colorbar : Bool = false, colorbar_border : Symbol = :solid, colorbar_lim : Tuple(Float64, Float64) = {0.0, 1.0}, unicode_exponent : Bool = true, thousands_separator : Char = ' ') : Plot #

Create a Plot from x/y data, building the canvas automatically. ameba:disable Metrics/CyclomaticComplexity


[View source]
def ceil_neg_log10(x : Float64) : Int32 #

[View source]
def char_marker(marker : Symbol) : Char #

[View source]
def char_marker(marker : Char) : Char #

[View source]
def char_marker(marker : String) : Char #

[View source]
def color_cycle : Array(Symbol) #

[View source]
def colormap_callback(name : Symbol) : Proc(Float64, Float64, Float64, UInt32) #

[View source]
def colormode : Symbol #

[View source]
def colormode=(m : Symbol) #

[View source]
def compact_repr(x : Number) : String #

[View source]
def complement(color : UInt32) : UInt32 #

[View source]
def complement(color : Symbol) : UInt32 #

[View source]
def default_height : Int32 #

[View source]
def default_size!(*, height : Int32 | Nil = nil, width : Int32 | Nil = nil) #

[View source]
def default_width : Int32 #

[View source]
def densityplot(x : Array(Float64), y : Array(Float64), *, dscale : Symbol | Proc(Float64, Float64) = :identity, name : String = "", color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :auto, title : String = "", xlabel : String = "", ylabel : String = "", height : Int32 | Nil = nil, width : Int32 | Nil = nil, border : Symbol = :solid, compact_labels : Bool = false, compact : Bool = false, blend : Bool = true, xlim : Tuple(Float64, Float64) = {0.0, 0.0}, ylim : Tuple(Float64, Float64) = {0.0, 0.0}, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, unicode_exponent : Bool = true, thousands_separator : Char = ' ', yflip : Bool = false, xflip : Bool = false) : Plot #

2D point-density plot (matches Julia UnicodePlots densityplot). Draws all (x, y) points onto a DensityCanvas; overlapping points accumulate counts that are rendered as ' '/'░'/'▒'/'▓'/'█'.


[View source]
def densityplot(x : Array(Number), y : Array(Number), **kwargs) : Plot #

[View source]
def densityplot!(plot : Plot, x : Array(Float64), y : Array(Float64), *, name : String = "", color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :auto) : Plot #

[View source]
def densityplot!(plot : Plot, x : Array(Number), y : Array(Number), **kwargs) : Plot #

[View source]
def extend_limits(vec : Enumerable(Float64), lims : Tuple(Float64, Float64), scale : Symbol = :identity) : Tuple(Float64, Float64) #

[View source]
def float_round_log10(x : Float64, m : Float64 | Nil = nil) : Float64 #

[View source]
def function_name(name : String, default : String) : String #

[View source]
def g32(g : UInt32) : UInt32 #

[View source]
def grn(c : UInt32) : UInt8 #

[View source]
def heatmap(z : Array(Array(Float64)), *, title : String = "", xlabel : String = "", ylabel : String = "", zlabel : String = "", colormap : Symbol = :viridis, zlim : Tuple(Float64, Float64) = {0.0, 0.0}, border : Symbol = :solid, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, unicode_exponent : Bool = true, thousands_separator : Char = ' ', compact_labels : Bool = false, compact : Bool = false, xfact : Float64 | Nil = nil, yfact : Float64 | Nil = nil, xoffset : Float64 = 0.0, yoffset : Float64 = 0.0, xlim : Tuple(Float64, Float64) = {0.0, 0.0}, ylim : Tuple(Float64, Float64) = {0.0, 0.0}, array : Bool = false, colorbar : Bool | Nil = nil, colorbar_border : Symbol = :solid, height : Int32 | Nil = nil, width : Int32 | Nil = nil, fix_ar : Bool = false) : Plot #

[View source]
def heatmap(z : Array(Array(Number)), **kwargs) : Plot #

[View source]
def histogram(data : Array(Float64), *, nbins : Int32 | Nil = nil, closed : Symbol = :left, vertical : Bool = false, stats : Bool = true, color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :green, title : String = "", xlabel : String = "", ylabel : String = "", border : Symbol = :barplot, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, unicode_exponent : Bool = true, thousands_separator : Char = ' ', xscale : Symbol | Proc(Float64, Float64) = :identity, symbols : Array(Char) = ['▏', '▎', '▍', '▌', '▋', '▊', '▉', '█'], width : Int32 | Nil = nil) : Plot #

[View source]
def histogram(data : Array(Number), **kwargs) : Plot #

[View source]
def hline!(plot : Plot, y : Float64, x : Array(Float64) | Nil = nil, **kwargs) : Plot #

[View source]
def lineplot(startx : Float64, endx : Float64, f : Float64 -> Float64, **kwargs) : Plot #

[View source]
def lineplot(x : Array(Float64), y : Array(Float64), *, canvas : Symbol = :braille, name : String = "", color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :auto, head_tail : Symbol | Nil = nil, head_tail_frac : Float64 = 0.05, title : String = "", xlabel : String = "", ylabel : String = "", xscale : Symbol | Proc(Float64, Float64) = :identity, yscale : Symbol | Proc(Float64, Float64) = :identity, height : Int32 | Nil = nil, width : Int32 | Nil = nil, border : Symbol = :solid, compact_labels : Bool = false, compact : Bool = false, blend : Bool = true, xlim : Tuple(Float64, Float64) = {0.0, 0.0}, ylim : Tuple(Float64, Float64) = {0.0, 0.0}, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, grid : Bool = true, yticks : Bool = true, xticks : Bool = true, min_height : Int32 = 2, min_width : Int32 = 5, yflip : Bool = false, xflip : Bool = false, unicode_exponent : Bool = true, thousands_separator : Char = ' ') : Plot #

[View source]
def lineplot(x : Array(Float64), f : Float64 -> Float64, **kwargs) : Plot #

[View source]
def lineplot(x : Array(T), f : Float64 -> Float64, **kwargs) : Plot forall T #

[View source]
def lineplot(x : Array(T), y : Array(U), **kwargs) : Plot forall T, U #

Generic numeric overloads for lineplot


[View source]
def lineplot(y : Array(Float64), **kwargs) : Plot #

Convenience overloads


[View source]
def lineplot(y : Array(T), **kwargs) : Plot forall T #

[View source]
def lineplot(f : Float64 -> Float64, **kwargs) : Plot #

[View source]
def lineplot!(plot : Plot, startx : Float64, endx : Float64, f : Float64 -> Float64, **kwargs) : Plot #

[View source]
def lineplot!(plot : Plot, x : Array(Float64), y : Array(Float64), *, name : String = "", color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :auto, head_tail : Symbol | Nil = nil, head_tail_frac : Float64 = 0.05) : Plot #

ameba:disable Metrics/CyclomaticComplexity


[View source]
def lineplot!(plot : Plot, x : Array(Float64), y : Array(Float64), **kwargs) : Plot #

[View source]
def lineplot!(plot : Plot, x : Array(T), y : Array(U), **kwargs) : Plot forall T, U #

[View source]
def lineplot!(plot : Plot, y : Array(Float64), **kwargs) : Plot #

[View source]
def lineplot!(plot : Plot, f : Float64 -> Float64, **kwargs) : Plot #

[View source]
def nice_repr(x : Int, unicode_exponent : Bool = true, thousands_separator : Char = ' ') : String #

[View source]
def nice_repr(x : Float64, unicode_exponent : Bool = true, thousands_separator : Char = ' ') : String #

[View source]
def nice_repr(x : Number, unicode_exponent : Bool = true, thousands_separator : Char = ' ') : String #

[View source]
def no_ansi_escape(str : String) : String #

[View source]
def out_stream_size(_io : IO) : Tuple(Int32, Int32) #

[View source]
def out_stream_size : Tuple(Int32, Int32) #

[View source]
def plot_color(color : Symbol) : UInt32 #

Normalize a user-facing plot color input to internal UInt32 color.


[View source]
def plot_color(color : UInt32) : UInt32 #

[View source]
def plot_color(color : Tuple(Int32, Int32, Int32)) : UInt32 #

[View source]
def plot_color(color : Nil) : UInt32 #

[View source]
def plotting_range_narrow(xmin : Float64, xmax : Float64) : Tuple(Float64, Float64) #

[View source]
def print_color(io : IO, color : UInt32, text : String, use_color : Bool, bgcol : UInt32) : Nil #

[View source]
def print_color(io : IO, color : UInt32, text : String, use_color : Bool = true) : Nil #

Print text with foreground color to io


[View source]
def print_color(io : IO, color : Symbol, text : String, use_color : Bool = true) : Nil #

[View source]
def r32(r : UInt32) : UInt32 #

[View source]
def red(c : UInt32) : UInt8 #

[View source]
def round_down_subtick(x : Float64, m : Float64) : Float64 #

[View source]
def round_up_subtick(x : Float64, m : Float64) : Float64 #

[View source]
def roundable(x : Float64) : Bool #

[View source]
def scale_callback(scale : Symbol) : Proc(Float64, Float64) #

[View source]
def scale_callback(scale : Proc(Float64, Float64)) : Proc(Float64, Float64) #

[View source]
def scatterplot(x : Array(Float64), y : Array(Float64), *, canvas : Symbol = :braille, name : String = "", color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :auto, marker : Symbol | Char | String = :pixel, title : String = "", xlabel : String = "", ylabel : String = "", xscale : Symbol | Proc(Float64, Float64) = :identity, yscale : Symbol | Proc(Float64, Float64) = :identity, height : Int32 | Nil = nil, width : Int32 | Nil = nil, border : Symbol = :solid, compact_labels : Bool = false, compact : Bool = false, blend : Bool = true, xlim : Tuple(Float64, Float64) = {0.0, 0.0}, ylim : Tuple(Float64, Float64) = {0.0, 0.0}, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, grid : Bool = true, yticks : Bool = true, xticks : Bool = true, min_height : Int32 = 2, min_width : Int32 = 5, yflip : Bool = false, xflip : Bool = false, unicode_exponent : Bool = true, thousands_separator : Char = ' ') : Plot #

[View source]
def scatterplot(x : Array(T), y : Array(U), **kwargs) : Plot forall T, U #

[View source]
def scatterplot(y : Array(Float64), **kwargs) : Plot #

[View source]
def scatterplot(y : Array(T), **kwargs) : Plot forall T #

[View source]
def scatterplot!(plot : Plot, x : Array(Float64), y : Array(Float64), *, name : String = "", color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :auto, marker : Symbol | Char | String = :pixel) : Plot #

[View source]
def scatterplot!(plot : Plot, x : Array(T), y : Array(U), **kwargs) : Plot forall T, U #

[View source]
def scatterplot!(plot : Plot, y : Array(Float64), **kwargs) : Plot #

[View source]
def show_plot(io : IO, p : Plot) : Nil #

[View source]
def sorted_keys_values(dict : Hash) : Tuple(Array(String), Array(Float64)) #

[View source]
def stairs(x : Array(Float64), y : Array(Float64), *, style : Symbol = :post, canvas : Symbol = :braille, name : String = "", color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :auto, title : String = "", xlabel : String = "", ylabel : String = "", xscale : Symbol | Proc(Float64, Float64) = :identity, yscale : Symbol | Proc(Float64, Float64) = :identity, height : Int32 | Nil = nil, width : Int32 | Nil = nil, border : Symbol = :solid, compact_labels : Bool = false, compact : Bool = false, blend : Bool = true, xlim : Tuple(Float64, Float64) = {0.0, 0.0}, ylim : Tuple(Float64, Float64) = {0.0, 0.0}, margin : Int32 = 3, padding : Int32 = 1, labels : Bool = true, grid : Bool = true, yticks : Bool = true, xticks : Bool = true, min_height : Int32 = 2, min_width : Int32 = 5, yflip : Bool = false, xflip : Bool = false, unicode_exponent : Bool = true, thousands_separator : Char = ' ') : Plot #

[View source]
def stairs(x : Array(Number), y : Array(Number), **kwargs) : Plot #

[View source]
def stairs(y : Array(Float64), **kwargs) : Plot #

[View source]
def stairs(y : Array(Number), **kwargs) : Plot #

[View source]
def stairs!(plot : Plot, x : Array(Float64), y : Array(Float64), *, name : String = "", color : Symbol | UInt32 | Tuple(Int32, Int32, Int32) = :auto, style : Symbol = :post) : Plot #

[View source]
def stairs!(plot : Plot, x : Array(Number), y : Array(Number), **kwargs) : Plot #

[View source]
def sturges(n : Int32) : Int32 #

Sturges' rule — kept for backward compatibility / user access.


[View source]
def superscript(s : String) : String #

[View source]
def superscript_str(s : String) : String #

[View source]
def transform_name(tr : Symbol, basename : String = "") : String #

[View source]
def transform_name(tr : Proc, basename : String = "") : String #

[View source]
def vline!(plot : Plot, x : Float64, y : Array(Float64) | Nil = nil, **kwargs) : Plot #

vline! and hline! helpers


[View source]