API

Autogenerated docstrings

UnicodePlots.AsciiCanvasType

As the name suggests the AsciiCanvas only uses ASCII characters to draw its content. Naturally, it doesn't look quite as nice as the Unicode-based ones. However, in some situations it might yield better results. Printing plots to a file is one of those situations.

The AsciiCanvas is best used in combination with lineplot. For scatterplot we suggest to use the DotCanvas instead.

source
UnicodePlots.BlockCanvasType

The BlockCanvas is also Unicode-based. It has half the resolution of the BrailleCanvas. In contrast to BrailleCanvas, the pixels don't have visible spacing between them. This canvas effectively turns every character into four pixels that can individually be manipulated using binary operations.

source
UnicodePlots.BrailleCanvasType

The type of canvas with the highest resolution for Unicode-based plotting. It uses the Unicode characters for the Braille symbols to represent individual pixel. This effectively turns every character into eight pixels that can individually be manipulated using binary operations.

source
UnicodePlots.DensityCanvasType

Unlike the BrailleCanvas, the density canvas does not simply mark a pixel as set. Instead it increments a counter per character that keeps track of the frequency of pixels drawn in that character. Together with a variable that keeps track of the maximum frequency, the canvas can thus draw the density of datapoints.

source
UnicodePlots.DotCanvasType

Similar to the AsciiCanvas, the DotCanvas only uses ASCII characters to draw its content. Naturally, it doesn't look quite as nice as the Unicode-based ones. However, in some situations it might yield better results. Printing plots to a file is one of those situations.

The DotCanvas is best used in combination with scatterplot. For lineplot we suggest to use the AsciiCanvas instead.

source
UnicodePlots.HeatmapCanvasType

The HeatmapCanvas is also Unicode-based. It has a half the resolution of the BlockCanvas. This canvas effectively turns every character into two pixels (top and bottom).

source
UnicodePlots.MVPType
MVP(x, y, z; projection = :orthographic, elevation = 35.264389682754654, azimuth = 45.0, zoom = 1.0, up = :z)

Description

Build up the "Model - View - Projection" transformation matrix (see codinglabs.net/articleworldviewprojectionmatrix.aspx).

This is typically used to adjust how 3D plot is viewed, see also the projection keyword in surfaceplot, isosurface.

source
UnicodePlots.PlotType
Plot(graphics; kw...)

Description

Decoration for objects that are GraphicsArea (or Canvas). It is used to surround the inner GraphicsArea object with additional information such as a title, border, and axis labels.

Usage

Plot(graphics; title = "", xlabel = "", ylabel = "", zlabel = "", border = :solid, compact = false, margin = 3, padding = 1, labels = true)

Plot(x, y, z, canvas; title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, grid = true, yflip = false, xflip = false, name = "")

Arguments

  • graphics : the GraphicsArea (e.g. a subtype of Canvas) that the plot should decorate.
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • z : depth position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Methods

  • title!(plot::Plot, title::String)

  • xlabel!(plot::Plot, xlabel::String)

  • ylabel!(plot::Plot, xlabel::String)

  • zlabel!(plot::Plot, zlabel::String)

  • label!(plot::Plot, where::Symbol, value::String)

  • label!(plot::Plot, where::Symbol, row::Integer, value::String)

Author(s)

  • Christof Stocker (github.com/Evizero)

See also

scatterplot, lineplot, BarplotGraphics, BrailleCanvas, BlockCanvas, AsciiCanvas

source
UnicodePlots.annotate!Method
annotate!(plot, x, y, text; kw...)

Description

Adds text to the plot at the position (x, y).

Arguments

  • text : a string of text.
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • color::Symbol = :auto : choose from (:green, :blue, :red, :yellow, :cyan, :magenta, :white, :normal, :auto), use an integer in [0-255], or provide 3 integers as RGB components.

Examples

julia> plt = lineplot([1, 2, 7], [9, -6, 8], title = "My Lineplot");
julia> annotate!(plt, 5, 5, "My text")
       ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀My Lineplot⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 
       ┌────────────────────────────────────────┐ 
    10 │⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⢇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠│ 
       │⠘⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠊⠁⠀│ 
       │⠀⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀My text⠀⠀⣀⠔⠊⠁⠀⠀⠀⠀│ 
       │⠀⠈⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠔⠊⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠔⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⢇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠤⠤⠤⠼⡤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⢤⠤⠶⠥⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤│ 
       │⠀⠀⠀⠀⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠈⡆⠀⠀⠀⠀⠀⠀⠀⣀⠔⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⢱⠀⠀⠀⠀⡠⠔⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⠀⢇⡠⠔⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
   -10 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       └────────────────────────────────────────┘ 
       ⠀1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀7⠀

See also

Plot, lineplot, scatterplot, stairs, BrailleCanvas, BlockCanvas, AsciiCanvas, DotCanvas

source
UnicodePlots.argumentsFunction
arguments([desc]; default = DEFAULT_KW, add = (), exclude = DEFAULT_EXCLUDED, remove = ())

Defines arguments for docstring genreration.

Arguments

  • desc::NamedTuple: add argument description in the form arg = desc.
  • default::Tuple: default UnicodePlots keywords.
  • add::Tuple: add extra symbols, not listed in default but present in DESCRIPTION.
  • remove::Tuple: remove symbols from default.
source
UnicodePlots.barplot!Method
barplot(text, heights; kw...)
barplot!(p, args...; kw...)

Description

Draws a horizontal barplot. It uses the first parameter (text) to denote the names for the bars, and the second parameter (heights) as their values. This means that the two vectors have to have the same length. Alternatively, one can specify a barplot using a dictionary dict. In that case, the keys will be used as the names and the values, which have to be numeric, will be used as the heights of the bars.

Usage

barplot(text, heights; border = :barplot, color = :green, maximum = nothing, title = "", xlabel = "", ylabel = "", xscale = :identity, width = 40, compact = false, blend = true, margin = 3, padding = 1, labels = true, unicode_exponent = true, yflip = false, xflip = false, symbols = ['■'], name = "")
barplot(dict; kw...)

Arguments

  • text : the labels / captions of the bars.
  • heights : the values / heights of the bars.
  • dict : a dictionary in which the keys will be used as text and the values will be used as heights.
  • xscale::Symbol = :identity : Function or Symbol to transform the bar length before plotting: this effectively scales the x-axis without influencing the captions of the individual bars (use xscale = :log10 for logscale).
  • color::Symbol = :auto : Vector of colors, or scalar - choose from (:green, :blue, :red, :yellow, :cyan, :magenta, :white, :normal, :auto), use an integer in [0-255], or provide 3 integers as RGB components.
  • maximum : optional maximal height.
  • symbols::Array = ['■'] : collection of characters used to render the bars.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Christof Stocker (github.com/Evizero)

Examples

julia> barplot(["Paris", "New York", "Madrid"],
               [2.244, 8.406, 3.165],
               xlabel = "population [in mil]")
            ┌                                        ┐ 
      Paris ┤■■■■■■■■■ 2.244                           
   New York ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 8.406   
     Madrid ┤■■■■■■■■■■■■ 3.165                        
            └                                        ┘ 
                        population [in mil]            

See also

Plot, histogram, BarplotGraphics

source
UnicodePlots.barplotMethod
barplot(text, heights; kw...)
barplot!(p, args...; kw...)

Description

Draws a horizontal barplot. It uses the first parameter (text) to denote the names for the bars, and the second parameter (heights) as their values. This means that the two vectors have to have the same length. Alternatively, one can specify a barplot using a dictionary dict. In that case, the keys will be used as the names and the values, which have to be numeric, will be used as the heights of the bars.

Usage

barplot(text, heights; border = :barplot, color = :green, maximum = nothing, title = "", xlabel = "", ylabel = "", xscale = :identity, width = 40, compact = false, blend = true, margin = 3, padding = 1, labels = true, unicode_exponent = true, yflip = false, xflip = false, symbols = ['■'], name = "")
barplot(dict; kw...)

Arguments

  • text : the labels / captions of the bars.
  • heights : the values / heights of the bars.
  • dict : a dictionary in which the keys will be used as text and the values will be used as heights.
  • xscale::Symbol = :identity : Function or Symbol to transform the bar length before plotting: this effectively scales the x-axis without influencing the captions of the individual bars (use xscale = :log10 for logscale).
  • color::Symbol = :auto : Vector of colors, or scalar - choose from (:green, :blue, :red, :yellow, :cyan, :magenta, :white, :normal, :auto), use an integer in [0-255], or provide 3 integers as RGB components.
  • maximum : optional maximal height.
  • symbols::Array = ['■'] : collection of characters used to render the bars.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Christof Stocker (github.com/Evizero)

Examples

julia> barplot(["Paris", "New York", "Madrid"],
               [2.244, 8.406, 3.165],
               xlabel = "population [in mil]")
            ┌                                        ┐ 
      Paris ┤■■■■■■■■■ 2.244                           
   New York ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 8.406   
     Madrid ┤■■■■■■■■■■■■ 3.165                        
            └                                        ┘ 
                        population [in mil]            

See also

Plot, histogram, BarplotGraphics

source
UnicodePlots.boxplot!Method
boxplot(data; kw...)
boxplot!(p, args...; kw...)

Description

Draws a box-and-whisker plot.

The first argument specifies the data to plot. This is a vector of vectors, with each inner vector representing a data series. We use a vector of vectors over a matrix to allow series of different lengths. Optionally, a list of text may be provided, with length equal to the number of series.

Alternatively, one can specify a boxplot using a dictionary. In that case, the values, which have to be numeric, will be used as the data series, and the keys, which have to be strings, will be used as the labels.

Usage

boxplot([text], data; border = :corners, color = :green, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, width = 40, compact = false, blend = true, xlim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, yflip = false, xflip = false, name = "")
boxplot(dict; kw...)

Arguments

  • text : the labels/captions of the boxes (optional).
  • data : a vector of vectors, with each inner vector representing a data series (choose a vector of vectors over a matrix to allow series of different lengths).
  • dict : a dictionary in which the keys will be used as text and the values will be used as data.
  • color::Symbol = :auto : Vector of colors, or scalar - choose from (:green, :blue, :red, :yellow, :cyan, :magenta, :white, :normal, :auto), use an integer in [0-255], or provide 3 integers as RGB components.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Matthew Lake (github.com/mgtlake)

Examples

julia> boxplot([1, 2, 3, 7]; title = "Test")
                       Test                    
    ┌                                        ┐ 
     ╷   ┌────┬─────────┐                   ╷  
     ├───┤    │         ├───────────────────┤  
     ╵   └────┴─────────┘                   ╵  
    └                                        ┘ 
     1                  4                   7  

See also

Plot, histogram, BoxplotGraphics

source
UnicodePlots.boxplotMethod
boxplot(data; kw...)
boxplot!(p, args...; kw...)

Description

Draws a box-and-whisker plot.

The first argument specifies the data to plot. This is a vector of vectors, with each inner vector representing a data series. We use a vector of vectors over a matrix to allow series of different lengths. Optionally, a list of text may be provided, with length equal to the number of series.

Alternatively, one can specify a boxplot using a dictionary. In that case, the values, which have to be numeric, will be used as the data series, and the keys, which have to be strings, will be used as the labels.

Usage

boxplot([text], data; border = :corners, color = :green, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, width = 40, compact = false, blend = true, xlim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, yflip = false, xflip = false, name = "")
boxplot(dict; kw...)

Arguments

  • text : the labels/captions of the boxes (optional).
  • data : a vector of vectors, with each inner vector representing a data series (choose a vector of vectors over a matrix to allow series of different lengths).
  • dict : a dictionary in which the keys will be used as text and the values will be used as data.
  • color::Symbol = :auto : Vector of colors, or scalar - choose from (:green, :blue, :red, :yellow, :cyan, :magenta, :white, :normal, :auto), use an integer in [0-255], or provide 3 integers as RGB components.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Matthew Lake (github.com/mgtlake)

Examples

julia> boxplot([1, 2, 3, 7]; title = "Test")
                       Test                    
    ┌                                        ┐ 
     ╷   ┌────┬─────────┐                   ╷  
     ├───┤    │         ├───────────────────┤  
     ╵   └────┴─────────┘                   ╵  
    └                                        ┘ 
     1                  4                   7  

See also

Plot, histogram, BoxplotGraphics

source
UnicodePlots.contourplot!Method
contourplot(x, y, A; kw...)
contourplot!(p, args...; kw...)

Draws a contour plot on a new canvas.

Usage

contourplot(x, y, A; canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", zlabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, colorbar = false, colorbar_border = :solid, colorbar_lim = (0, 1), colormap = :viridis, yflip = false, xflip = false, name = "", zlim = (0, 0))

Arguments

  • A : Matrix of interest for which contours are extracted, or Function evaluated as f(x, y).
  • levels : the number of contour levels.
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • zlabel::String = "" : text displayed on the z axis (colorbar) of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • zlim::Tuple = (0, 0) : colormap scaled data range.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • colorbar::Bool = false : toggle the colorbar.
  • colormap::Symbol = :viridis : choose a symbol from ColorSchemes.jl e.g. :viridis, or supply a function f: (z, zmin, zmax) -> Int(0-255), or a vector of RGB tuples.
  • colorbar_lim::Tuple = (0, 1) : colorbar limit.
  • colorbar_border::Symbol = :solid : color bar bounding box style (:solid, :bold, :dashed, :dotted, :ascii, :none).
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.

Author(s)

  • T Bltg (github.com/t-bltg)

Examples

julia> contourplot(-1:.1:1, -1:.1:1, (x, y) -> 1000√(x^2 + y^2))
      ┌────────────────────────────────────────┐ 1_000
    1 │⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⠒⠊⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠒⠢⣄⡀⠀⠀⠀⠀⠀⠀⠀│ ┌──┐ 
      │⠀⠀⠀⠀⠀⡠⠖⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠑⠤⡀⠀⠀⠀⠀│ │▄▄│ 
      │⠀⠀⢀⡰⠊⠀⠀⠀⠀⠀⠀⠀⢀⣀⠤⠔⠒⠒⠉⠉⠉⠉⠓⠒⠒⠤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠘⠢⡀⠀⠀│ │▄▄│ 
      │⠀⡰⠁⠀⠀⠀⠀⠀⠀⢀⡤⠒⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠑⠢⡀⠀⠀⠀⠀⠀⠀⠈⢆⠀│ │▄▄│ 
      │⡜⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠈⠢⡄⠀⠀⠀⠀⠀⠀⢣│ │▄▄│ 
      │⠀⠀⠀⠀⠀⠀⢠⠃⠀⠀⠀⠀⠀⠀⢀⠔⠊⠁⠀⠀⠀⠀⠈⠙⠢⢄⠀⠀⠀⠀⠀⠀⠑⡄⠀⠀⠀⠀⠀⠀│ │▄▄│ 
      │⠀⠀⠀⠀⠀⢠⠇⠀⠀⠀⠀⠀⠀⡜⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢣⠀⠀⠀⠀⠀⠀⢘⠄⠀⠀⠀⠀⠀│ │▄▄│ 
      │⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠠⡃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢈⠆⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀│ │▄▄│ 
      │⠀⠀⠀⠀⠀⠘⡆⠀⠀⠀⠀⠀⠀⠣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜⠀⠀⠀⠀⠀⠀⢠⠃⠀⠀⠀⠀⠀│ │▄▄│ 
      │⠀⠀⠀⠀⠀⠀⠱⡀⠀⠀⠀⠀⠀⠀⠉⠒⣄⣀⠀⠀⠀⠀⢀⣀⠔⠉⠀⠀⠀⠀⠀⠀⢀⠎⠀⠀⠀⠀⠀⠀│ │▄▄│ 
      │⢇⠀⠀⠀⠀⠀⠀⠘⠦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⡠⠃⠀⠀⠀⠀⠀⠀⡰│ │▄▄│ 
      │⠈⠢⡀⠀⠀⠀⠀⠀⠀⠈⠒⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠔⠋⠀⠀⠀⠀⠀⠀⢀⠖⠁│ │▄▄│ 
      │⠀⠀⠈⠱⣀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠒⠢⠤⢤⣀⣀⣀⣀⡠⠤⠤⠒⠊⠁⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀│ │▄▄│ 
      │⠀⠀⠀⠀⠀⠑⠦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠒⠁⠀⠀⠀⠀│ │▄▄│ 
   -1 │⠀⠀⠀⠀⠀⠀⠀⠀⠙⠒⠤⢄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠤⠔⠊⠁⠀⠀⠀⠀⠀⠀⠀│ └──┘ 
      └────────────────────────────────────────┘  0   
      ⠀-1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀1⠀      

See also

Plot, lineplot, BrailleCanvas

source
UnicodePlots.contourplotMethod
contourplot(A; kw...)

Usage

Draws a contour plot of matrix A along axis x and y on a new canvas.

The y axis is flipped by default:

Julia matrices (images) │ UnicodePlots
                        │
           axes(A, 2)   │
           o───────→    │   ↑
           │            │   │
axes(A, 1) │            │ y │
           │            │   │
           ↓            │   o───────→
                        │       x
source
UnicodePlots.contourplotMethod
contourplot(x, y, A; kw...)
contourplot!(p, args...; kw...)

Draws a contour plot on a new canvas.

Usage

contourplot(x, y, A; canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", zlabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, colorbar = false, colorbar_border = :solid, colorbar_lim = (0, 1), colormap = :viridis, yflip = false, xflip = false, name = "", zlim = (0, 0))

Arguments

  • A : Matrix of interest for which contours are extracted, or Function evaluated as f(x, y).
  • levels : the number of contour levels.
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • zlabel::String = "" : text displayed on the z axis (colorbar) of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • zlim::Tuple = (0, 0) : colormap scaled data range.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • colorbar::Bool = false : toggle the colorbar.
  • colormap::Symbol = :viridis : choose a symbol from ColorSchemes.jl e.g. :viridis, or supply a function f: (z, zmin, zmax) -> Int(0-255), or a vector of RGB tuples.
  • colorbar_lim::Tuple = (0, 1) : colorbar limit.
  • colorbar_border::Symbol = :solid : color bar bounding box style (:solid, :bold, :dashed, :dotted, :ascii, :none).
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.

Author(s)

  • T Bltg (github.com/t-bltg)

Examples

julia> contourplot(-1:.1:1, -1:.1:1, (x, y) -> 1000√(x^2 + y^2))
      ┌────────────────────────────────────────┐ 1_000
    1 │⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⠒⠊⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠒⠢⣄⡀⠀⠀⠀⠀⠀⠀⠀│ ┌──┐ 
      │⠀⠀⠀⠀⠀⡠⠖⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠑⠤⡀⠀⠀⠀⠀│ │▄▄│ 
      │⠀⠀⢀⡰⠊⠀⠀⠀⠀⠀⠀⠀⢀⣀⠤⠔⠒⠒⠉⠉⠉⠉⠓⠒⠒⠤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠘⠢⡀⠀⠀│ │▄▄│ 
      │⠀⡰⠁⠀⠀⠀⠀⠀⠀⢀⡤⠒⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠑⠢⡀⠀⠀⠀⠀⠀⠀⠈⢆⠀│ │▄▄│ 
      │⡜⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠈⠢⡄⠀⠀⠀⠀⠀⠀⢣│ │▄▄│ 
      │⠀⠀⠀⠀⠀⠀⢠⠃⠀⠀⠀⠀⠀⠀⢀⠔⠊⠁⠀⠀⠀⠀⠈⠙⠢⢄⠀⠀⠀⠀⠀⠀⠑⡄⠀⠀⠀⠀⠀⠀│ │▄▄│ 
      │⠀⠀⠀⠀⠀⢠⠇⠀⠀⠀⠀⠀⠀⡜⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢣⠀⠀⠀⠀⠀⠀⢘⠄⠀⠀⠀⠀⠀│ │▄▄│ 
      │⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠠⡃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢈⠆⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀│ │▄▄│ 
      │⠀⠀⠀⠀⠀⠘⡆⠀⠀⠀⠀⠀⠀⠣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜⠀⠀⠀⠀⠀⠀⢠⠃⠀⠀⠀⠀⠀│ │▄▄│ 
      │⠀⠀⠀⠀⠀⠀⠱⡀⠀⠀⠀⠀⠀⠀⠉⠒⣄⣀⠀⠀⠀⠀⢀⣀⠔⠉⠀⠀⠀⠀⠀⠀⢀⠎⠀⠀⠀⠀⠀⠀│ │▄▄│ 
      │⢇⠀⠀⠀⠀⠀⠀⠘⠦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⡠⠃⠀⠀⠀⠀⠀⠀⡰│ │▄▄│ 
      │⠈⠢⡀⠀⠀⠀⠀⠀⠀⠈⠒⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠔⠋⠀⠀⠀⠀⠀⠀⢀⠖⠁│ │▄▄│ 
      │⠀⠀⠈⠱⣀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠒⠢⠤⢤⣀⣀⣀⣀⡠⠤⠤⠒⠊⠁⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀│ │▄▄│ 
      │⠀⠀⠀⠀⠀⠑⠦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠒⠁⠀⠀⠀⠀│ │▄▄│ 
   -1 │⠀⠀⠀⠀⠀⠀⠀⠀⠙⠒⠤⢄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠤⠔⠊⠁⠀⠀⠀⠀⠀⠀⠀│ └──┘ 
      └────────────────────────────────────────┘  0   
      ⠀-1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀1⠀      

See also

Plot, lineplot, BrailleCanvas

source
UnicodePlots.default_size!Method
default_size!(;
    height::Union{Integer,Nothing} = nothing,
    width::Union{Integer,Nothing} = nothing,
)

Change and return the default plot size (height, width).

source
UnicodePlots.densityplot!Method
densityplot(x, y; kw...)
densityplot!(p, args...; kw...)

Description

Draws a density plot for the given points.

The first vector x should contain the horizontal positions for all the points. The second vector y should contain the corresponding vertical positions respectively. The two vectors must thus be of the same length and ordering. One can pass an arbitrary dscale (Function or Symbol) for transforming density counts (e.g. peaks damping).

Usage

densityplot(x, y; dscale = :identity, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, yflip = false, xflip = false, name = "")

Arguments

  • dscale : density scale function.
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Christof Stocker (github.com/Evizero)

Examples

julia> densityplot(randn(1_000), randn(1_000); title = "Density Plot")
                     Density Plot                
      ┌────────────────────────────────────────┐ 
    4 │                                        │ 
      │                                        │ 
      │                                        │ 
      │                                        │ 
      │          ░        ░░  ░                │ 
      │           ░ ░░░░░░▓▒▒▒░░░░░            │ 
      │            ░▒▒▓▒░▒▒▓▓▓▒▒░░░░           │ 
      │         ░░  ░░▓▓░▓▒█▓▒░░▒░░░           │ 
      │            ░░░▒▒▒░▒▓▒▒▒░░░░░           │ 
      │          ░  ░░░░░▓░░░░░░░ ░            │ 
      │                 ░░░░░ ░  ░             │ 
      │                                        │ 
      │                                        │ 
      │                                        │ 
   -4 │                                        │ 
      └────────────────────────────────────────┘ 
       -4                                     4  

See also

Plot, scatterplot, DensityCanvas

source
UnicodePlots.densityplotMethod
densityplot(x, y; kw...)
densityplot!(p, args...; kw...)

Description

Draws a density plot for the given points.

The first vector x should contain the horizontal positions for all the points. The second vector y should contain the corresponding vertical positions respectively. The two vectors must thus be of the same length and ordering. One can pass an arbitrary dscale (Function or Symbol) for transforming density counts (e.g. peaks damping).

Usage

densityplot(x, y; dscale = :identity, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, yflip = false, xflip = false, name = "")

Arguments

  • dscale : density scale function.
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Christof Stocker (github.com/Evizero)

Examples

julia> densityplot(randn(1_000), randn(1_000); title = "Density Plot")
                     Density Plot                
      ┌────────────────────────────────────────┐ 
    4 │                                        │ 
      │                                        │ 
      │                                        │ 
      │                                        │ 
      │          ░        ░░  ░                │ 
      │           ░ ░░░░░░▓▒▒▒░░░░░            │ 
      │            ░▒▒▓▒░▒▒▓▓▓▒▒░░░░           │ 
      │         ░░  ░░▓▓░▓▒█▓▒░░▒░░░           │ 
      │            ░░░▒▒▒░▒▓▒▒▒░░░░░           │ 
      │          ░  ░░░░░▓░░░░░░░ ░            │ 
      │                 ░░░░░ ░  ░             │ 
      │                                        │ 
      │                                        │ 
      │                                        │ 
   -4 │                                        │ 
      └────────────────────────────────────────┘ 
       -4                                     4  

See also

Plot, scatterplot, DensityCanvas

source
UnicodePlots.draw_axes!Method
draw_axes!(plot, x, y, z, scale = 0.25)

Description

Draws (X, Y, Z) cartesian coordinates axes in (R, G, B) colors, at position p = (x, y, z). If p = (x, y) is given, draws at screen coordinates instead.

source
UnicodePlots.frustumMethod
frustum(l, r, b, t, n, f)

Description

Computes the perspective projection matrix (see songho.ca/opengl/gl_projectionmatrix.html#perspective).

Arguments

- `l`: left coordinate of the vertical clipping plane.
- `r`: right coordinate of the vertical clipping plane.
- `b`: bottom coordinate of the horizontal clipping plane.
- `t`: top coordinate of the horizontal clipping plane.
- `n`: distance to the near depth clipping plane.
- `f`: distance to the far depth clipping plane.
source
UnicodePlots.heatmapMethod
heatmap(A; kw...)

Description

Draws a heatmap for the given points. It uses the Matrix A as the values of the heatmap, with the column and row indices of the matrix as x and y coordinates respectively.

Usage

heatmap(A::AbstractMatrix; height = 0, width = 0, yfact = nothing, xfact = nothing, array = false, title = "", xlabel = "", ylabel = "", zlabel = "", xscale = :identity, yscale = :identity, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, colorbar = false, colorbar_border = :solid, colorbar_lim = (0, 1), colormap = :viridis, grid = true, yflip = false, xflip = false, name = "", zlim = (0, 0), fix_ar = false)

Arguments

  • A : input matrix (color values).
  • yfact : scale for the y coordinate labels (defaults to 0 - i.e. each row in A maps to one unit, y origin starting at 1). If set to anything else, the y origin will start at 0.
  • xfact : scale for the x coordinate (defaults to 0 - i.e. each column in A maps to one unit, x origin starting at 1). If set to anything else, the x origin will start at 0.
  • yoffset : plotting offset for the y coordinate (after scaling).
  • xoffset : plotting offset for the x coordinate (after scaling).
  • array : use array display convention (origin at the North-West corner of the plot, hence flipping y versus regular plots).
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • zlabel::String = "" : text displayed on the z axis (colorbar) of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • zlim::Tuple = (0, 0) : colormap scaled data range.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • colorbar::Bool = false : toggle the colorbar.
  • colormap::Symbol = :viridis : choose a symbol from ColorSchemes.jl e.g. :viridis, or supply a function f: (z, zmin, zmax) -> Int(0-255), or a vector of RGB tuples.
  • colorbar_lim::Tuple = (0, 1) : colorbar limit.
  • colorbar_border::Symbol = :solid : color bar bounding box style (:solid, :bold, :dashed, :dotted, :ascii, :none).
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.
  • fix_ar::Bool = false : fix terminal aspect ratio (experimental).

Author(s)

  • Rowan Katekar (github.com/rjkat)

Examples

julia> heatmap(repeat(collect(0:10)', outer=(11, 1)), zlabel="z")
      ┌───────────┐  10   
   11 │▄▄▄▄▄▄▄▄▄▄▄│ ┌──┐  
      │▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│  
      │▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│  
      │▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│ z
      │▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│  
    1 │▄▄▄▄▄▄▄▄▄▄▄│ └──┘  
      └───────────┘  0    
       1        11        

See also

Plot, HeatmapCanvas

source
UnicodePlots.histogramMethod
histogram(data; kw...)

Description

Draws a horizontal or vertical histogram of the given data, fitted to an Histogram.

Usage

histogram(x; nbins, closed = :left, vertical = false, stats = true, border = :barplot, color = :green, title = "", xlabel = "", ylabel = "", compact = false, blend = true, margin = 3, padding = 1, labels = true, unicode_exponent = true, yflip = false, xflip = false, symbols = ['■'], name = "")

Arguments

  • x : array of numbers for which the histogram should be computed.
  • nbins : approximate number of bins that should be used.
  • closed : if :left (default), the bin intervals are left-closed $[a, b)$; if :right, intervals are right-closed $(a, b]$.
  • vertical : vertical histogram instead of the default horizontal one.
  • stats : display statistics (vertical only).
  • symbols::Array = ['■'] : collection of characters used to render the bars.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Iain Dunning (github.com/IainNZ)
  • Christof Stocker (github.com/Evizero)
  • Kenta Sato (github.com/bicycle1885)

Examples

julia> histogram(randn(1_000) * .1, closed=:right, nbins=15)
                  ┌                                        ┐ 
   (-0.3 , -0.25] ┤▎ 1                                       
   (-0.25, -0.2 ] ┤██▉ 17                                    
   (-0.2 , -0.15] ┤█████████▍ 53                             
   (-0.15, -0.1 ] ┤████████████████▎ 92                      
   (-0.1 , -0.05] ┤████████████████████████▋ 141             
   (-0.05,  0.0 ] ┤███████████████████████████████████  200  
   ( 0.0 ,  0.05] ┤█████████████████████████████████▋ 192    
   ( 0.05,  0.1 ] ┤█████████████████████████▏ 143            
   ( 0.1 ,  0.15] ┤████████████████▎ 92                      
   ( 0.15,  0.2 ] ┤███████▊ 45                               
   ( 0.2 ,  0.25] ┤██▋ 15                                    
   ( 0.25,  0.3 ] ┤█▍ 8                                      
   ( 0.3 ,  0.35] ┤▎ 1                                       
                  └                                        ┘ 
                                   Frequency                
julia> histogram(randn(100_000) .* .1, nbins=60, vertical=true, height=10)
         ┌                                             ┐ 
   8_093  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▃█▇▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  
          ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▅████▆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  
          ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▇██████▅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  
          ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▅████████▄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  
          ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▃██████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  
          ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▂████████████▂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  
          ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▂██████████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  
          ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▁████████████████▃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  
          ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀▁▅██████████████████▅▁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  
       0  ⠀⠀⠀⠀⠀⠀▁▁▂▃▅██████████████████████▆▃▂▁▁⠀⠀⠀⠀⠀⠀⠀  
         └                                             ┘ 
         ⠀-0.44⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀0.46⠀ 
         ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀μ ± σ: 0.0 ± 0.1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 

See also

Plot, barplot, BarplotGraphics

source
UnicodePlots.hline!Function
hline!(plot::Plot{<:Canvas}, y::AbstractVector{<:Number}, x::Union{AbstractVector{<:Number},Nothing} = nothing; kw...)

Draws horizontal lines at positions given in y (and optional x values).

source
UnicodePlots.hline!Function
hline!(plot::Plot{<:Canvas}, y::Number, x::Union{AbstractVector{<:Number},Nothing} = nothing; kw...)

Draws an horizontal line at position y (and optional x values).

source
UnicodePlots.horizontal_histogramMethod
horizontal_histogram(hist; kw...)

Description

Draws a horizontal histogram of the given StatsBase.Histogram.

Note internally that horizontal_histogram is a simply wrapper for barplot, which means that it supports the same keyword arguments.

Usage

horizontal_histogram(hist; border = :barplot, color = :green, title = "", xlabel = "", ylabel = "", xscale = :identity, width = 40, compact = false, blend = true, xlim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, yflip = false, xflip = false, symbols = ['■'], name = "")

Arguments

  • hist : a fitted StatsBase.Histogram that should be plotted.
  • symbols::Array = ['■'] : collection of characters used to render the bars.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.
source
UnicodePlots.imageplotMethod
imageplot(img; kw...)

Plot an image using ImageInTerminal (sixels are supported if the terminal emulator supports them).

Usage

imageplot(img; title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, grid = true, yflip = false, xflip = false, name = "")

Arguments

  • img : AbstractArray{<:Colorant} to be displayed.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • T Bltg (github.com/t-bltg)

Examples

julia> using ImageInTerminal  # mandatory
julia> using TestImages
julia> imageplot(testimage("monarch_color_256"), title="monarch")
                  monarch               
    ┌                                 ┐ 
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  
    └                                 ┘ 

See also

Plot

source
UnicodePlots.isosurface!Method
isosurface(x, y, z, V; kw...)
isosurface!(p, args...; kw...)

Extract and plot an isosurface from volumetric data, or a given implicit function.

Usage

isosurface(x, y, z, V; isovalue = 0, centroid = true, canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", zlabel = "", height = 15, width = 40, border = :solid, compact = false, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, colorbar = false, colorbar_border = :solid, colorbar_lim = (0, 1), colormap = :viridis, yflip = false, xflip = false, projection = :orthographic, elevation = 35.264389682754654, azimuth = 45.0, axes3d = true, zoom = 1.0, up = :z, zlim = (0, 0))

Arguments

  • V : Array (volume) of interest for which a surface is extracted, or Function evaluated as f(x, y, z).
  • isovalue : chosen surface isovalue.
  • cull : cull (hide) back faces.
  • legacy : use the legacy Marching Cubes algorithm instead of the topology enhanced algorithm.
  • centroid : display triangulation centroid instead of triangle vertices.
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • z : depth position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • zlabel::String = "" : text displayed on the z axis (colorbar) of the plot.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • zlim::Tuple = (0, 0) : colormap scaled data range.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • colorbar::Bool = false : toggle the colorbar.
  • colormap::Symbol = :viridis : choose a symbol from ColorSchemes.jl e.g. :viridis, or supply a function f: (z, zmin, zmax) -> Int(0-255), or a vector of RGB tuples.
  • colorbar_lim::Tuple = (0, 1) : colorbar limit.
  • colorbar_border::Symbol = :solid : color bar bounding box style (:solid, :bold, :dashed, :dotted, :ascii, :none).
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • projection::Symbol = :orthographic : projection for 3D plots (:ortho(graphic), :persp(ective), or Model-View-Projection (MVP) matrix).
  • axes3d::Bool = true : draw 3d axes (x -> :red, y -> :green, z -> :blue).
  • elevation::Float = 35.264389682754654 : elevation angle above or below the floor plane (-90 ≤ θ ≤ 90).
  • azimuth::Float = 45.0 : azimutal angle around the up vector (-180° ≤ φ ≤ 180°).
  • zoom::Float = 1.0 : zooming factor in 3D.
  • up::Symbol = :z : up vector (:x, :y or :z), prefix with m -> - or p -> + to change the sign e.g. :mz for -z axis pointing upwards.

Author(s)

  • T Bltg (github.com/t-bltg)

Examples

julia> torus(x, y, z, r = .2, R = .5) = (√(x^2 + y^2) - R)^2 + z^2 - r^2
julia> isosurface(-1:.1:1, -1:.1:1, -1:.1:1, torus, elevation = 50, zoom = 2, cull = true)
    ┌────────────────────────────────────────┐ 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢀⢀⠠⢄⢄⠄⠄⡠⡠⠤⡀⡀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠔⠌⠜⠀⠡⠠⠁⠡⠠⠁⠈⠄⠌⠈⠄⠌⠀⠪⠠⠤⡀⡀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⡠⠔⠅⠌⠈⠄⠌⠀⡁⡀⠨⡀⠄⠠⠡⠠⡀⠥⠠⠈⠀⠡⠠⠁⠡⠱⠢⡀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⢀⣜⠃⡁⠄⢊⠈⠄⡰⠐⡀⢂⡞⢈⡰⡨⡂⢆⡁⣱⠔⢁⠘⢀⠠⠁⡑⠠⢈⠘⣲⡀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⡚⠥⠁⡀⠂⢂⠈⠄⡖⡫⠗⠋⠉⠀⠀⠀⠀⠀⠈⠉⠉⠱⢝⠱⠠⠁⡐⠐⢀⠈⢌⢧⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⡟⠤⠁⡀⠂⢂⢈⠄⢮⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡿⠠⡁⡐⠐⢀⠈⢤⢚⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⢽⠗⠅⡀⠂⢂⢀⠂⢂⠓⡢⡄⣀⠀⠀⠀⠀⠀⢀⡀⢀⢰⠂⡑⠐⡀⡐⠐⠀⠨⢔⡟⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠈⠭⠄⠌⠰⠀⡀⠂⢂⠀⡐⠐⠌⠔⠑⠅⠡⠊⠢⠡⠂⢂⠀⡐⠐⣀⠐⠠⡁⡃⡑⠁⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⠈⠨⠅⠄⠌⠀⡆⢀⠐⠐⢀⠐⠐⠀⠄⠂⠂⡀⠂⡂⡀⠂⢂⠀⡂⢐⠔⠈⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⢥⢀⡂⡃⠇⠃⡁⡡⠨⡈⡨⠈⠬⠨⠢⢈⢠⠑⠒⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⠋⠓⠂⠊⠒⠂⠚⠘⠚⠙⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⣀⠼⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠔⠉⠀⠀⠀⠈⠑⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    └────────────────────────────────────────┘ 

See also

Plot, MVP, surfaceplot, BrailleCanvas

source
UnicodePlots.isosurfaceMethod
isosurface(x, y, z, V; kw...)
isosurface!(p, args...; kw...)

Extract and plot an isosurface from volumetric data, or a given implicit function.

Usage

isosurface(x, y, z, V; isovalue = 0, centroid = true, canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", zlabel = "", height = 15, width = 40, border = :solid, compact = false, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, colorbar = false, colorbar_border = :solid, colorbar_lim = (0, 1), colormap = :viridis, yflip = false, xflip = false, projection = :orthographic, elevation = 35.264389682754654, azimuth = 45.0, axes3d = true, zoom = 1.0, up = :z, zlim = (0, 0))

Arguments

  • V : Array (volume) of interest for which a surface is extracted, or Function evaluated as f(x, y, z).
  • isovalue : chosen surface isovalue.
  • cull : cull (hide) back faces.
  • legacy : use the legacy Marching Cubes algorithm instead of the topology enhanced algorithm.
  • centroid : display triangulation centroid instead of triangle vertices.
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • z : depth position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • zlabel::String = "" : text displayed on the z axis (colorbar) of the plot.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • zlim::Tuple = (0, 0) : colormap scaled data range.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • colorbar::Bool = false : toggle the colorbar.
  • colormap::Symbol = :viridis : choose a symbol from ColorSchemes.jl e.g. :viridis, or supply a function f: (z, zmin, zmax) -> Int(0-255), or a vector of RGB tuples.
  • colorbar_lim::Tuple = (0, 1) : colorbar limit.
  • colorbar_border::Symbol = :solid : color bar bounding box style (:solid, :bold, :dashed, :dotted, :ascii, :none).
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • projection::Symbol = :orthographic : projection for 3D plots (:ortho(graphic), :persp(ective), or Model-View-Projection (MVP) matrix).
  • axes3d::Bool = true : draw 3d axes (x -> :red, y -> :green, z -> :blue).
  • elevation::Float = 35.264389682754654 : elevation angle above or below the floor plane (-90 ≤ θ ≤ 90).
  • azimuth::Float = 45.0 : azimutal angle around the up vector (-180° ≤ φ ≤ 180°).
  • zoom::Float = 1.0 : zooming factor in 3D.
  • up::Symbol = :z : up vector (:x, :y or :z), prefix with m -> - or p -> + to change the sign e.g. :mz for -z axis pointing upwards.

Author(s)

  • T Bltg (github.com/t-bltg)

Examples

julia> torus(x, y, z, r = .2, R = .5) = (√(x^2 + y^2) - R)^2 + z^2 - r^2
julia> isosurface(-1:.1:1, -1:.1:1, -1:.1:1, torus, elevation = 50, zoom = 2, cull = true)
    ┌────────────────────────────────────────┐ 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢀⢀⠠⢄⢄⠄⠄⡠⡠⠤⡀⡀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠔⠌⠜⠀⠡⠠⠁⠡⠠⠁⠈⠄⠌⠈⠄⠌⠀⠪⠠⠤⡀⡀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⡠⠔⠅⠌⠈⠄⠌⠀⡁⡀⠨⡀⠄⠠⠡⠠⡀⠥⠠⠈⠀⠡⠠⠁⠡⠱⠢⡀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⢀⣜⠃⡁⠄⢊⠈⠄⡰⠐⡀⢂⡞⢈⡰⡨⡂⢆⡁⣱⠔⢁⠘⢀⠠⠁⡑⠠⢈⠘⣲⡀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⡚⠥⠁⡀⠂⢂⠈⠄⡖⡫⠗⠋⠉⠀⠀⠀⠀⠀⠈⠉⠉⠱⢝⠱⠠⠁⡐⠐⢀⠈⢌⢧⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⡟⠤⠁⡀⠂⢂⢈⠄⢮⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡿⠠⡁⡐⠐⢀⠈⢤⢚⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⢽⠗⠅⡀⠂⢂⢀⠂⢂⠓⡢⡄⣀⠀⠀⠀⠀⠀⢀⡀⢀⢰⠂⡑⠐⡀⡐⠐⠀⠨⢔⡟⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠈⠭⠄⠌⠰⠀⡀⠂⢂⠀⡐⠐⠌⠔⠑⠅⠡⠊⠢⠡⠂⢂⠀⡐⠐⣀⠐⠠⡁⡃⡑⠁⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⠈⠨⠅⠄⠌⠀⡆⢀⠐⠐⢀⠐⠐⠀⠄⠂⠂⡀⠂⡂⡀⠂⢂⠀⡂⢐⠔⠈⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⢥⢀⡂⡃⠇⠃⡁⡡⠨⡈⡨⠈⠬⠨⠢⢈⢠⠑⠒⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⠀⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⠋⠓⠂⠊⠒⠂⠚⠘⠚⠙⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠀⠀⣀⠼⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    │⠔⠉⠀⠀⠀⠈⠑⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
    └────────────────────────────────────────┘ 

See also

Plot, MVP, surfaceplot, BrailleCanvas

source
UnicodePlots.keywordsFunction
keywords([extra]; default = DEFAULT_KW, add = (), exclude = DEFAULT_EXCLUDED, remove = ())

Adds default keywords to a function signature, in a docstring.

Arguments

  • extra::NamedTuple: add extra keywords in the form keyword = value.
  • default::Tuple: default UnicodePlots keywords.
  • add::Tuple: add extra symbols, not listed in default but present in KEYWORDS.
  • remove::Tuple: remove symbols from default.
source
UnicodePlots.label!Method
label!(plot, where, value, [color])

label!(plot, where, row, value, [color])

This method is responsible for the setting all the textual decorations of a plot.

Note that where can be any of: :tl (top-left), :t (top-center), :tr (top-right), :bl (bottom-left), :b (bottom-center), :br (bottom-right), :l (left), :r (right).

If where is either :l, or :r, then row can be between 1 and the number of character rows of the plots canvas.

source
UnicodePlots.lineplotFunction
lineplot(; kw...)
lineplot(y; kw...)
lineplot(x, y; kw...)
lineplot!(p, args...; kw...)

Description

Draws a path through the given points on a new canvas.

The first (optional) vector x should contain the horizontal positions for all the points along the path. The second vector y should then contain the corresponding vertical positions respectively. This means that the two vectors must be of the same length and ordering.

Usage

lineplot([x], y; head_tail = nothing, head_tail_frac = 0.05, canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, grid = true, yflip = false, xflip = false, name = "")
lineplot([start], [stop], fun; kw...)

Arguments

  • fun : a unary function $f: R -> R$ that should be evaluated, and drawn as a path from start to stop (numbers in the domain).
  • head_tail : color the line head and/or tail with the complement of the chosen color (:head, :tail, :both).
  • head_tail_frac : fraction of the arrow head or tail (e.g. provide 0.1 for 10%).
  • x : horizontal position for each point (can be a real number or of type TimeType), if omitted, the axes of y will be used as x.
  • format : specify the ticks date format (TimeType only).
  • color::Symbol = :auto : Vector of colors, or scalar - choose from (:green, :blue, :red, :yellow, :cyan, :magenta, :white, :normal, :auto), use an integer in [0-255], or provide 3 integers as RGB components.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Christof Stocker (github.com/Evizero)
  • Milktrader (github.com/milktrader)

Examples

julia> lineplot([1, 2, 7], [9, -6, 8]; title = "My Lineplot")
       ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀My Lineplot⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 
       ┌────────────────────────────────────────┐ 
    10 │⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⢇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠│ 
       │⠘⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠊⠁⠀│ 
       │⠀⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠔⠊⠁⠀⠀⠀⠀│ 
       │⠀⠈⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠔⠊⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠔⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⢇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠤⠤⠤⠼⡤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⢤⠤⠶⠥⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤│ 
       │⠀⠀⠀⠀⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠈⡆⠀⠀⠀⠀⠀⠀⠀⣀⠔⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⢱⠀⠀⠀⠀⡠⠔⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⠀⢇⡠⠔⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
   -10 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       └────────────────────────────────────────┘ 
       ⠀1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀7⠀ 

See also

Plot, scatterplot, stairs, BrailleCanvas, BlockCanvas, AsciiCanvas, DotCanvas

source
UnicodePlots.lineplot!Function
lineplot(; kw...)
lineplot(y; kw...)
lineplot(x, y; kw...)
lineplot!(p, args...; kw...)

Description

Draws a path through the given points on a new canvas.

The first (optional) vector x should contain the horizontal positions for all the points along the path. The second vector y should then contain the corresponding vertical positions respectively. This means that the two vectors must be of the same length and ordering.

Usage

lineplot([x], y; head_tail = nothing, head_tail_frac = 0.05, canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, grid = true, yflip = false, xflip = false, name = "")
lineplot([start], [stop], fun; kw...)

Arguments

  • fun : a unary function $f: R -> R$ that should be evaluated, and drawn as a path from start to stop (numbers in the domain).
  • head_tail : color the line head and/or tail with the complement of the chosen color (:head, :tail, :both).
  • head_tail_frac : fraction of the arrow head or tail (e.g. provide 0.1 for 10%).
  • x : horizontal position for each point (can be a real number or of type TimeType), if omitted, the axes of y will be used as x.
  • format : specify the ticks date format (TimeType only).
  • color::Symbol = :auto : Vector of colors, or scalar - choose from (:green, :blue, :red, :yellow, :cyan, :magenta, :white, :normal, :auto), use an integer in [0-255], or provide 3 integers as RGB components.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Christof Stocker (github.com/Evizero)
  • Milktrader (github.com/milktrader)

Examples

julia> lineplot([1, 2, 7], [9, -6, 8]; title = "My Lineplot")
       ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀My Lineplot⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 
       ┌────────────────────────────────────────┐ 
    10 │⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⢇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠│ 
       │⠘⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠊⠁⠀│ 
       │⠀⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠔⠊⠁⠀⠀⠀⠀│ 
       │⠀⠈⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠔⠊⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠔⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⢇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠤⠤⠤⠼⡤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⢤⠤⠶⠥⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤│ 
       │⠀⠀⠀⠀⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠈⡆⠀⠀⠀⠀⠀⠀⠀⣀⠔⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⢱⠀⠀⠀⠀⡠⠔⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⠀⢇⡠⠔⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
   -10 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
       └────────────────────────────────────────┘ 
       ⠀1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀7⠀ 

See also

Plot, scatterplot, stairs, BrailleCanvas, BlockCanvas, AsciiCanvas, DotCanvas

source
UnicodePlots.lookatFunction
lookat(eye, target, up_vector)

Description

Computes the scene camera (see songho.ca/opengl/gl_camera.html).

Arguments

- `eye`: position of the camera in world space (e.g. [0, 0, 10]).
- `target`: target point to look at in world space (usually to origin = [0, 0, 0]).
- `up_vector`: up vector (usually +z = [0, 0, 1]).
source
UnicodePlots.orthoMethod
ortho(l, r, b, t, n, f)

Description

Computes the orthographic projection matrix (see songho.ca/opengl/gl_projectionmatrix.html#ortho).

Arguments

- `l`: left coordinate of the vertical clipping plane.
- `r`: right coordinate of the vertical clipping plane.
- `b`: bottom coordinate of the horizontal clipping plane.
- `t`: top coordinate of the horizontal clipping plane.
- `n`: distance to the near depth clipping plane.
- `f`: distance to the far depth clipping plane.
source
UnicodePlots.png_imageMethod
png_image(p::Plot, font = nothing, pixelsize = 32, transparent = true, foreground = nothing, background = nothing, bounding_box = nothing, bounding_box_glyph = nothing)

Renders a png image.

Arguments

  • pixelsize::Integer = 32: controls the image size scaling.
  • font::Union{Nothing,AbstractString} = nothing: select a font by name, or fall-back to a system font.
  • transparent::Bool = true: use a transparent background.
  • foreground::UserColorType = nothing: choose a foreground color for un-colored text.
  • background::UserColorType = nothing: choose a background color for the rendered image.
  • bounding_box::UserColorType = nothing: debugging bounding box color.
  • bounding_box_glyph::UserColorType = nothing: debugging glyph bounding box color.
  • row_fact::Union{Nothing,Real} = nothing: row spacing multiplier (e.g. for histogram).
source
UnicodePlots.polarplot!Method
polarplot(θ, r; kw...)
polarplot!(p, args...; kw...)

Draws θ angles and r radii on a polar plot.

Usage

polarplot(θ, r; canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, grid = true, yflip = false, xflip = false, name = "")

Arguments

  • θ : angles values (radians).
  • r : radii, or Function evaluated as r(θ).
  • rlim : plotting range for the r axis ((0, 0) stands for automatic).
  • degrees : label angles using degrees.
  • num_rad_lab : number of radius labels.
  • ang_rad_lab : angle where the radius labels are drawn.
  • scatter : use scatter instead of lines.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • T Bltg (github.com/t-bltg)

Examples

julia> polarplot(range(0, 2π; length = 20), range(0, 2; length = 20))
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀90°⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡤⠤⠒⠒⠉⠉⠉⠉⠉⡏⠉⠉⠉⠉⠓⠒⠦⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⢀⡤⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠒⠤⡀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⡠⠞⠓⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠜2⢄⠀⠀⠀⠀⠀   
        ⠀⠀⠀⣠⠊⠀⠀⠀⠀⠉⠢⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠊⠁⠀⠀⠀⠱⣄⠀⠀⠀   
        ⠀⠀⡴⠁⠀⠀⠀⠀⠀⠀⠀⠀⠑⠤⡀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀1⠔⠁⠀⠀⠀⠀⠀⠀⠀⠈⢦⠀⠀   
        ⠀⡸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣈⠶⢖⠒⠒⠒⠢⣇⡀⠀⠀⢀⠔⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣇⠀   
        ⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⠉⠢⣀⠀⡇⢣⡠⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀   
   180° ⠀⡧⠤⠤⠤⠤⠤⠤⠤⠤⢤⠧⠤⠤⠤⠤⠤⠤⠤⠤⡵0⡭⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⢼⠀ 0°
        ⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⢀⠔⠊⠀⡇⠈⠒⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢿⠀   
        ⠀⢱⡀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⢀⡠⠊⠁⠀⠀⠀⡇⠀⠀⠀⠉⠢⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢎⡏⠀   
        ⠀⠀⠳⡀⠀⠀⠀⠀⠀⠀⠀⠱⡠⠔⠁⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠑⠤⡀⠀⠀⠀⠀⠀⢀⠔⢁⠞⠀⠀   
        ⠀⠀⠀⠙⢄⠀⠀⠀⠀⢀⠔⠊⠈⠢⣀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠈⠒⢄⢀⡠⠔⠁⡰⠋⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠑⢦⡠⠊⠁⠀⠀⠀⠀⠀⠉⠒⠢⢄⣀⠀⡇⠀⠀⠀⠀⠀⢀⣀⣀⡠⠔⠊⠉⢢⡤⠊⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠈⠓⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⡏⠉⠉⠉⠉⠉⠁⠀⠀⠀⣀⠤⠒⠁⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠓⠒⠤⠤⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⡤⠤⠖⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀270°⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   

See also

Plot, lineplot, BrailleCanvas

source
UnicodePlots.polarplotMethod
polarplot(θ, r; kw...)
polarplot!(p, args...; kw...)

Draws θ angles and r radii on a polar plot.

Usage

polarplot(θ, r; canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, grid = true, yflip = false, xflip = false, name = "")

Arguments

  • θ : angles values (radians).
  • r : radii, or Function evaluated as r(θ).
  • rlim : plotting range for the r axis ((0, 0) stands for automatic).
  • degrees : label angles using degrees.
  • num_rad_lab : number of radius labels.
  • ang_rad_lab : angle where the radius labels are drawn.
  • scatter : use scatter instead of lines.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • T Bltg (github.com/t-bltg)

Examples

julia> polarplot(range(0, 2π; length = 20), range(0, 2; length = 20))
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀90°⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡤⠤⠒⠒⠉⠉⠉⠉⠉⡏⠉⠉⠉⠉⠓⠒⠦⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⢀⡤⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠒⠤⡀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⡠⠞⠓⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠜2⢄⠀⠀⠀⠀⠀   
        ⠀⠀⠀⣠⠊⠀⠀⠀⠀⠉⠢⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠊⠁⠀⠀⠀⠱⣄⠀⠀⠀   
        ⠀⠀⡴⠁⠀⠀⠀⠀⠀⠀⠀⠀⠑⠤⡀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀1⠔⠁⠀⠀⠀⠀⠀⠀⠀⠈⢦⠀⠀   
        ⠀⡸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣈⠶⢖⠒⠒⠒⠢⣇⡀⠀⠀⢀⠔⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣇⠀   
        ⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⠉⠢⣀⠀⡇⢣⡠⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀   
   180° ⠀⡧⠤⠤⠤⠤⠤⠤⠤⠤⢤⠧⠤⠤⠤⠤⠤⠤⠤⠤⡵0⡭⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⢼⠀ 0°
        ⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⢀⠔⠊⠀⡇⠈⠒⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢿⠀   
        ⠀⢱⡀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⢀⡠⠊⠁⠀⠀⠀⡇⠀⠀⠀⠉⠢⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢎⡏⠀   
        ⠀⠀⠳⡀⠀⠀⠀⠀⠀⠀⠀⠱⡠⠔⠁⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠑⠤⡀⠀⠀⠀⠀⠀⢀⠔⢁⠞⠀⠀   
        ⠀⠀⠀⠙⢄⠀⠀⠀⠀⢀⠔⠊⠈⠢⣀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠈⠒⢄⢀⡠⠔⠁⡰⠋⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠑⢦⡠⠊⠁⠀⠀⠀⠀⠀⠉⠒⠢⢄⣀⠀⡇⠀⠀⠀⠀⠀⢀⣀⣀⡠⠔⠊⠉⢢⡤⠊⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠈⠓⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⡏⠉⠉⠉⠉⠉⠁⠀⠀⠀⣀⠤⠒⠁⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠓⠒⠤⠤⣀⣀⣀⣀⣀⣇⣀⣀⣀⣀⡤⠤⠖⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   
        ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀270°⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   

See also

Plot, lineplot, BrailleCanvas

source
UnicodePlots.preprocess!Method
preprocess!(c::GraphicsArea)

Optional step: pre-process canvas before printing rows (e.g. for costly computations). Returns a callback for optional cleanup after printing.

source
UnicodePlots.savefigMethod
savefig(p, filename; color = false, kw...)

Save the given plot to a txt orpng` file.

Arguments - txt

  • color::Bool = false: output the ANSI color codes to the file.

Arguments - png

see help?> UnicodePlots.png_image

Examples

julia> savefig(lineplot([0, 1]), "foo.txt")
julia> savefig(lineplot([0, 1]), "foo.png"; font = "JuliaMono", pixelsize = 32, transparent = false)
source
UnicodePlots.scatterplotFunction
scatterplot(; kw...)
scatterplot(y; kw...)
scatterplot(x, y; kw...)
scatterplot!(p, args...; kw...)

Description

Draws the given points on a new canvas.

The first (optional) vector x should contain the horizontal positions for all the points. The second vector y should then contain the corresponding vertical positions respectively. This means that the two vectors must be of same length and ordering.

Usage

scatterplot([x], y; canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, grid = true, yflip = false, xflip = false, name = "")

Arguments

  • marker : choose a marker from (:circle, :rect, :diamond, :hexagon, :cross, :xcross, :utriangle, :dtriangle, :rtriangle, :ltriangle, :pentagon, :star4, :star5, :star6, :star8, :vline, :hline, :+, :x), a Char, a unit length String or a Vector of these.
  • color::Symbol = :auto : Vector of colors, or scalar - choose from (:green, :blue, :red, :yellow, :cyan, :magenta, :white, :normal, :auto), use an integer in [0-255], or provide 3 integers as RGB components.
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Christof Stocker (github.com/Evizero)

Examples

julia> scatterplot(randn(50), randn(50), title = "My Scatterplot")
      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀My Scatterplot⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 
      ┌────────────────────────────────────────┐ 
    3 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠠⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠠⠀⠀⠂⡀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀│ 
      │⠈⠀⠀⠀⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠌⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀⡇⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⡀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⡀⡏⠀⠉⠀⠀⠂⠀⠠⠀⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠤⠤⠤⠤⠤⠤⠤⠴⠤⢤⠤⠤⠤⠤⠤⠤⠬⠤⢤⠤⡧⠤⢤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⠀⠀⠀⠀⠂⠀⠀⡇⠀⠀⠀⠂⠠⡀⠀⡀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠈⠀⠀⡇⠀⠀⠀⠀⠈⠀⠀⠀⠁⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⡇⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
   -3 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      └────────────────────────────────────────┘ 
      ⠀-2⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀2⠀ 

See also

Plot, lineplot, stairs, BrailleCanvas, BlockCanvas, AsciiCanvas, DotCanvas

source
UnicodePlots.scatterplot!Function
scatterplot(; kw...)
scatterplot(y; kw...)
scatterplot(x, y; kw...)
scatterplot!(p, args...; kw...)

Description

Draws the given points on a new canvas.

The first (optional) vector x should contain the horizontal positions for all the points. The second vector y should then contain the corresponding vertical positions respectively. This means that the two vectors must be of same length and ordering.

Usage

scatterplot([x], y; canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, grid = true, yflip = false, xflip = false, name = "")

Arguments

  • marker : choose a marker from (:circle, :rect, :diamond, :hexagon, :cross, :xcross, :utriangle, :dtriangle, :rtriangle, :ltriangle, :pentagon, :star4, :star5, :star6, :star8, :vline, :hline, :+, :x), a Char, a unit length String or a Vector of these.
  • color::Symbol = :auto : Vector of colors, or scalar - choose from (:green, :blue, :red, :yellow, :cyan, :magenta, :white, :normal, :auto), use an integer in [0-255], or provide 3 integers as RGB components.
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Christof Stocker (github.com/Evizero)

Examples

julia> scatterplot(randn(50), randn(50), title = "My Scatterplot")
      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀My Scatterplot⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 
      ┌────────────────────────────────────────┐ 
    3 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠠⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠠⠀⠀⠂⡀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀│ 
      │⠈⠀⠀⠀⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠌⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀⡇⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⡀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⡀⡏⠀⠉⠀⠀⠂⠀⠠⠀⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠤⠤⠤⠤⠤⠤⠤⠴⠤⢤⠤⠤⠤⠤⠤⠤⠬⠤⢤⠤⡧⠤⢤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⠀⠀⠀⠀⠂⠀⠀⡇⠀⠀⠀⠂⠠⡀⠀⡀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠈⠀⠀⡇⠀⠀⠀⠀⠈⠀⠀⠀⠁⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⡇⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
   -3 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
      └────────────────────────────────────────┘ 
      ⠀-2⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀2⠀ 

See also

Plot, lineplot, stairs, BrailleCanvas, BlockCanvas, AsciiCanvas, DotCanvas

source
UnicodePlots.spyMethod
spy(A; kw...)

Description

Plots the sparsity pattern for the given matrix A. This means that a scatterplot that resembles the matrix is drawn, in which only the pixel for non-zero elements of the matrix are set.

If the parameters width and height are not explicitly specified, then the function will attempt to preserve the aspect ratio of the matrix, while also attempting to fit the resulting plot within the bounding box specified by maxwidth and maxheight.

Usage

spy(A; maxwidth = 0, maxheight = 0, zeros = false, canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, grid = true, yflip = false, xflip = false, name = "", fix_ar = false)

Arguments

  • A : matrix of interest for which non-zero elements should be drawn.
  • maxheight : maximum number of character rows that should be used for plotting.
  • maxwidth : maximum number of characters per row that should be used for plotting.
  • height::Int = 15 : exact number of character rows that should be used for plotting (0 stands for automatic).
  • width::Int = 40 : exact number of characters per row that should be used for plotting (0 stands for automatic).
  • show_zeros : show zeros pattern instead of default nonzeros.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.
  • fix_ar::Bool = false : fix terminal aspect ratio (experimental).

Author(s)

  • Dominique Orban (github.com/dpo)
  • Christof Stocker (github.com/Evizero)
  • Jake Bolewski (github.com/jakebolewski)

Examples

julia> using SparseArrays
julia> spy(sprandn(50, 120, .05))
      ┌────────────────────────────────────────────────────────────┐    
    1 │⡀⠨⠂⠀⠠⠀⠠⠀⠀⠀⠂⠀⡀⠂⠀⠀⠰⠈⠈⠂⡀⠀⠀⠀⠀⠐⠀⡀⡀⠀⠀⢄⡀⠀⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢄⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠐⠴⠄│ > 0
      │⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⠠⠄⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⢀⠀⡀⠀⠄⠘⠀⠀⡀⠀⠀⠀⠂⠠⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀│ < 0
      │⠂⠀⠀⠀⠐⠐⠀⠂⠀⡀⠐⢀⠀⠀⠀⠀⡀⠀⠈⠀⠄⠀⠀⠨⠀⠀⠀⠀⠀⠠⠀⢀⠀⠀⠉⠐⠄⠄⠀⠔⠀⠀⠂⠀⢐⠀⠀⠀⡀⠘⢀⠀⠁⠄⠀⠠⠀⠄⠀⠄│    
      │⠀⢀⠀⠀⠀⠀⠀⠠⠀⠂⠀⠄⠀⠘⠈⠌⢀⠀⠀⠀⠐⠀⠁⠀⠀⠀⢀⠀⠀⠠⠀⠁⠄⠀⠀⠀⠂⢀⠀⠀⠀⠀⢀⡁⠀⠀⠂⠠⠀⠀⠀⠀⠀⠊⠁⠀⠀⠀⠀⠄│    
      │⠀⠅⠀⠀⠀⠀⢄⠈⠄⠠⠈⠀⠀⠀⠀⡀⠀⢀⠠⠀⠀⠀⠁⠀⠀⡀⠃⠀⠀⠈⠈⠁⠀⠁⠠⢀⠀⢁⠀⠀⢀⠀⠀⠀⢀⠀⠠⠂⠀⠁⢁⠀⠂⠀⠀⠆⠌⠀⠀⠀│    
      │⠀⠀⠔⠀⠀⠀⠀⢀⠀⠁⢀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⡀⠀⠀⠀⡀⠀⠈⠀⠀⠀⡁⠁⠀⠀⠀⠠⠀⠀⠀⠄⡀⠀⠀⠀⠊⠀⠀⠄⠀⠀⠀⠀⠀⠀⠠⠀⠀⠄⠀│    
      │⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠅⠄⡀⠀⠀⢂⠂⠄⠑⠀⠀⠀⢄⠀⠀⠠⠂⠁⡀⠀⢠⠈⠀⠂⠀⠀⠄⠀⠀⠀⠄⠀⠀⠃⠂⠀⠄⢀⠀⠀⠀⠀⠀⠀⠀│    
      │⠀⠐⠀⠀⠂⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠌⠀⠂⠀⠀⠀⠀⡀⢁⠁⠨⠀⠀⠀⠂⠀⠀⠨⠀⠁⠀⠀⠀⠀⠀⠊⠀⠄⠀⠀⠁⠐⠠⠀⢀⠀⠀⠀⠈⠀⠀⠁⠐⠄⠄│    
      │⢉⠀⢀⠁⠀⠀⠀⠀⠈⠀⠀⠀⠀⠁⠀⠠⠀⠀⠁⠀⠀⠀⡠⠁⠀⠀⠀⠀⠉⠠⡀⠀⠀⠀⢀⡀⠄⠀⠀⠀⠄⠀⠀⠈⠄⠀⠑⠀⠀⠀⠀⠀⠀⠠⠀⡀⡀⠀⠀⠀│    
      │⠅⠈⠈⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀⠀⠂⠀⠀⡄⠀⠀⠄⠀⠀⠠⠀⠀⠠⠈⠀⠂⠢⠈⠀⠀⠀⠄⠀⠀⠐⠀⠀⠀⠀⠀⠀⠀⠠⠀⠀⠀⠀⠀⠀⢀⠤⠀⠀⠀⠀│    
      │⠀⠀⠀⠂⠁⠀⠀⠀⠀⠁⠀⠘⠀⠂⢠⠀⠀⠀⠀⠀⢃⠀⠐⠈⠄⠐⠀⠀⠀⢀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⡀⠀⡀⠀⠀⠁⠀⠁⠀⠁⠠⠔⠀⢁⡀│    
   50 │⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠈⠀⠂⠠⠀⠀⠀⠖⠀⠀⠀⠈⠀⠀⠀⠀⠀⡀⠠⠀⢀⠀⠅⠀⠀⠐⠀⠀⠀⠀⠠⠀⠠⠀⠀⢀⠀│    
      └────────────────────────────────────────────────────────────┘    
      ⠀1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀120⠀    
      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀315 ≠ 0⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀    

See also

Plot, scatterplot, BrailleCanvas, BlockCanvas, AsciiCanvas, DotCanvas

source
UnicodePlots.stairs!Method
stairs(x, y; kw...)
stairs!(p, args...; kw...)

Description

Draws a staircase plot on a new canvas.

The first (optional) vector x should contain the horizontal positions for all the points. The second vector y should then contain the corresponding vertical positions respectively. This means that the two vectors must be of same length and ordering.

Usage

stairs(x, y; style = :post, canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, grid = true, yflip = false, xflip = false, name = "")

Arguments

  • style : specifies where the transition of the stair takes place (can be either :pre or :post).
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Christof Stocker (github.com/Evizero)
  • Dominique (github.com/dpo)

Examples

julia> stairs([1, 2, 4, 7, 8], [1, 3, 4, 2, 7], style = :post, title = "My Staircase Plot")
     ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀My Staircase Plot⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 
     ┌────────────────────────────────────────┐ 
   7 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⡄⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⢸⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠧⠤⠤⠤⠤⠼│ 
     │⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
   1 │⣀⣀⣀⣀⣀⣸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
     └────────────────────────────────────────┘ 
     ⠀1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀8⠀ 

See also

Plot, scatterplot, lineplot, BrailleCanvas, BlockCanvas, AsciiCanvas, DotCanvas

source
UnicodePlots.stairsMethod
stairs(x, y; kw...)
stairs!(p, args...; kw...)

Description

Draws a staircase plot on a new canvas.

The first (optional) vector x should contain the horizontal positions for all the points. The second vector y should then contain the corresponding vertical positions respectively. This means that the two vectors must be of same length and ordering.

Usage

stairs(x, y; style = :post, canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", xscale = :identity, yscale = :identity, height = 15, width = 40, border = :solid, compact = false, blend = true, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, grid = true, yflip = false, xflip = false, name = "")

Arguments

  • style : specifies where the transition of the stair takes place (can be either :pre or :post).
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.

Author(s)

  • Christof Stocker (github.com/Evizero)
  • Dominique (github.com/dpo)

Examples

julia> stairs([1, 2, 4, 7, 8], [1, 3, 4, 2, 7], style = :post, title = "My Staircase Plot")
     ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀My Staircase Plot⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 
     ┌────────────────────────────────────────┐ 
   7 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⡄⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⢸⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⢸│ 
     │⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠧⠤⠤⠤⠤⠼│ 
     │⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
   1 │⣀⣀⣀⣀⣀⣸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ 
     └────────────────────────────────────────┘ 
     ⠀1⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀8⠀ 

See also

Plot, scatterplot, lineplot, BrailleCanvas, BlockCanvas, AsciiCanvas, DotCanvas

source
UnicodePlots.surfaceplot!Function
surfaceplot(x, y, A; kw...)
surfaceplot!(p, args...; kw...)

Draws a 3D surface plot on a new canvas (masking values using NaNs is supported). To plot a slice one can pass an anonymous function which maps to a constant height: zscale = z -> a_constant. By default, zscale = :aspect normalizes heights (z axis) to the x or y axes. The x, y and z axes of the 3D cartesian frame are mapped respectively to the :red, :green and :blue colors.

Usage

surfaceplot(x, y, A; lines = false, canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", zlabel = "", height = 15, width = 40, border = :solid, compact = false, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, colorbar = false, colorbar_border = :solid, colorbar_lim = (0, 1), colormap = :viridis, yflip = false, xflip = false, projection = :orthographic, elevation = 35.264389682754654, azimuth = 45.0, axes3d = true, zoom = 1.0, up = :z, name = "", zlim = (0, 0))

Arguments

  • A : Matrix of surface heights, or Function evaluated as f(x, y).
  • lines : use lineplot instead of scatterplot (for regular increasing data).
  • zscale::Symbol = :aspect : scale heights (:identity, :aspect, tuple of (min, max) values, or arbitrary scale function).
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • zlabel::String = "" : text displayed on the z axis (colorbar) of the plot.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • zlim::Tuple = (0, 0) : colormap scaled data range.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • colorbar::Bool = false : toggle the colorbar.
  • colormap::Symbol = :viridis : choose a symbol from ColorSchemes.jl e.g. :viridis, or supply a function f: (z, zmin, zmax) -> Int(0-255), or a vector of RGB tuples.
  • colorbar_lim::Tuple = (0, 1) : colorbar limit.
  • colorbar_border::Symbol = :solid : color bar bounding box style (:solid, :bold, :dashed, :dotted, :ascii, :none).
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • projection::Symbol = :orthographic : projection for 3D plots (:ortho(graphic), :persp(ective), or Model-View-Projection (MVP) matrix).
  • axes3d::Bool = true : draw 3d axes (x -> :red, y -> :green, z -> :blue).
  • elevation::Float = 35.264389682754654 : elevation angle above or below the floor plane (-90 ≤ θ ≤ 90).
  • azimuth::Float = 45.0 : azimutal angle around the up vector (-180° ≤ φ ≤ 180°).
  • zoom::Float = 1.0 : zooming factor in 3D.
  • up::Symbol = :z : up vector (:x, :y or :z), prefix with m -> - or p -> + to change the sign e.g. :mz for -z axis pointing upwards.

Author(s)

  • T Bltg (github.com/t-bltg)

Examples

julia> sombrero(x, y) = 15sinc(√(x^2 + y^2) / π)
julia> surfaceplot(-8:.5:8, -8:.5:8, sombrero)
    ┌────────────────────────────────────────┐  15 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ ┌──┐
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡰⡃⢝⢆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠭⠂⠒⠭⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣠⣤⣴⣥⡅⣭⣬⣦⣤⣄⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣖⡻⠝⡪⢒⢵⣥⡫⠇⠼⢝⣬⡮⡒⢕⠫⢟⣲⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⢗⣒⣊⡩⠔⢁⢎⣐⡱⡁⢏⢎⣂⡱⡈⠢⢍⣑⣒⡺⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⣠⣾⡿⠿⣿⣿⣕⣒⣒⣊⣽⣯⡾⠵⠅⠮⠮⢷⣽⣯⣑⣒⣒⣪⣿⣿⠿⢿⣷⣄⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠐⠻⠿⠛⠛⠛⠛⠽⢿⣶⣶⡾⠓⠉⠢⠈⡀⢁⠁⠔⠉⠚⢷⣶⣶⡿⠯⠛⠛⠛⠛⠿⠟⠂⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⣯⣯⣓⢶⣷⡆⣶⣾⡶⣚⣽⣽⠿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⡳⡻⡃⢟⢟⢞⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⢀⡠⠜⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⠆⡵⠕⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘
    └────────────────────────────────────────┘ -3  

See also

Plot, MVP, lineplot, scatterplot, BrailleCanvas

source
UnicodePlots.surfaceplotMethod
surfaceplot(x, y, A; kw...)
surfaceplot!(p, args...; kw...)

Draws a 3D surface plot on a new canvas (masking values using NaNs is supported). To plot a slice one can pass an anonymous function which maps to a constant height: zscale = z -> a_constant. By default, zscale = :aspect normalizes heights (z axis) to the x or y axes. The x, y and z axes of the 3D cartesian frame are mapped respectively to the :red, :green and :blue colors.

Usage

surfaceplot(x, y, A; lines = false, canvas = UnicodePlots.BrailleCanvas, title = "", xlabel = "", ylabel = "", zlabel = "", height = 15, width = 40, border = :solid, compact = false, xlim = (0, 0), ylim = (0, 0), margin = 3, padding = 1, labels = true, unicode_exponent = true, colorbar = false, colorbar_border = :solid, colorbar_lim = (0, 1), colormap = :viridis, yflip = false, xflip = false, projection = :orthographic, elevation = 35.264389682754654, azimuth = 45.0, axes3d = true, zoom = 1.0, up = :z, name = "", zlim = (0, 0))

Arguments

  • A : Matrix of surface heights, or Function evaluated as f(x, y).
  • lines : use lineplot instead of scatterplot (for regular increasing data).
  • zscale::Symbol = :aspect : scale heights (:identity, :aspect, tuple of (min, max) values, or arbitrary scale function).
  • x : horizontal position for each point.
  • y : vertical position for each point.
  • title::String = "" : text displayed on top of the plot.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • zlabel::String = "" : text displayed on the z axis (colorbar) of the plot.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • zlim::Tuple = (0, 0) : colormap scaled data range.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • colorbar::Bool = false : toggle the colorbar.
  • colormap::Symbol = :viridis : choose a symbol from ColorSchemes.jl e.g. :viridis, or supply a function f: (z, zmin, zmax) -> Int(0-255), or a vector of RGB tuples.
  • colorbar_lim::Tuple = (0, 1) : colorbar limit.
  • colorbar_border::Symbol = :solid : color bar bounding box style (:solid, :bold, :dashed, :dotted, :ascii, :none).
  • canvas::UnionAll = UnicodePlots.BrailleCanvas : type of canvas used for drawing.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • projection::Symbol = :orthographic : projection for 3D plots (:ortho(graphic), :persp(ective), or Model-View-Projection (MVP) matrix).
  • axes3d::Bool = true : draw 3d axes (x -> :red, y -> :green, z -> :blue).
  • elevation::Float = 35.264389682754654 : elevation angle above or below the floor plane (-90 ≤ θ ≤ 90).
  • azimuth::Float = 45.0 : azimutal angle around the up vector (-180° ≤ φ ≤ 180°).
  • zoom::Float = 1.0 : zooming factor in 3D.
  • up::Symbol = :z : up vector (:x, :y or :z), prefix with m -> - or p -> + to change the sign e.g. :mz for -z axis pointing upwards.

Author(s)

  • T Bltg (github.com/t-bltg)

Examples

julia> sombrero(x, y) = 15sinc(√(x^2 + y^2) / π)
julia> surfaceplot(-8:.5:8, -8:.5:8, sombrero)
    ┌────────────────────────────────────────┐  15 
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ ┌──┐
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡰⡃⢝⢆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠭⠂⠒⠭⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣠⣤⣴⣥⡅⣭⣬⣦⣤⣄⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣖⡻⠝⡪⢒⢵⣥⡫⠇⠼⢝⣬⡮⡒⢕⠫⢟⣲⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⢗⣒⣊⡩⠔⢁⢎⣐⡱⡁⢏⢎⣂⡱⡈⠢⢍⣑⣒⡺⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠀⠀⣠⣾⡿⠿⣿⣿⣕⣒⣒⣊⣽⣯⡾⠵⠅⠮⠮⢷⣽⣯⣑⣒⣒⣪⣿⣿⠿⢿⣷⣄⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⠐⠻⠿⠛⠛⠛⠛⠽⢿⣶⣶⡾⠓⠉⠢⠈⡀⢁⠁⠔⠉⠚⢷⣶⣶⡿⠯⠛⠛⠛⠛⠿⠟⠂⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⣯⣯⣓⢶⣷⡆⣶⣾⡶⣚⣽⣽⠿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⡳⡻⡃⢟⢟⢞⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠀⢀⡠⠜⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⠆⡵⠕⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
    │⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘
    └────────────────────────────────────────┘ -3  

See also

Plot, MVP, lineplot, scatterplot, BrailleCanvas

source
UnicodePlots.title!Method
title!(plot, newtitle)

Sets a new title for the given plot. Alternatively, the current title can be queried using title.

source
UnicodePlots.titleMethod
title(plot) -> String

Returns the current title of the given plot. Alternatively, the title can be changed with title!.

source
UnicodePlots.vertical_histogramMethod
vertical_histogram(hist; kw...)

Description

Draws a vertical histogram of the given StatsBase.Histogram.

Usage

vertical_histogram(hist; border = :barplot, color = :green, title = "", xlabel = "", ylabel = "", compact = false, blend = true, margin = 3, padding = 1, labels = true, unicode_exponent = true, yflip = false, xflip = false, symbols = ['■'], name = "")

Arguments

  • hist : a fitted StatsBase.Histogram that should be plotted.
  • symbols::Array = ['■'] : collection of characters used to render the bars.
  • title::String = "" : text displayed on top of the plot.
  • name::String = "" : current drawing annotation displayed on the right.
  • xlabel::String = "" : text displayed on the x axis of the plot.
  • ylabel::String = "" : text displayed on the y axis of the plot.
  • xscale::Symbol = :identity : x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
  • yscale::Symbol = :identity : y-axis scale.
  • labels::Bool = true : show plot labels.
  • border::Symbol = :solid : plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).
  • margin::Int = 3 : number of empty characters to the left of the whole plot.
  • padding::Int = 1 : left and right space between the labels and the canvas.
  • height::Int = 15 : number of canvas rows, or :auto.
  • width::Int = 40 : number of characters per canvas row, or :auto.
  • xlim::Tuple = (0, 0) : plotting range for the x axis ((0, 0) stands for automatic).
  • ylim::Tuple = (0, 0) : plotting range for the y axis.
  • xflip::Bool = false : set true to flip the x axis.
  • yflip::Bool = false : set true to flip the y axis.
  • grid::Bool = true : draws grid-lines at the origin.
  • compact::Bool = false : compress the plot (compact labels, removes margins and padding).
  • unicode_exponent::Bool = true : use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.
  • blend::Bool = true : blend colors on the underlying canvas.
source
UnicodePlots.vline!Function
vline!(plot::Plot{<:Canvas}, x::AbstractVector{<:Number}, y::Union{AbstractVector{<:Number},Nothing} = nothing; kw...)

Draws vertical lines at positions given in x (and optional y values).

source
UnicodePlots.vline!Function
vline!(plot::Plot{<:Canvas}, x::Number, y::Union{AbstractVector{<:Number},Nothing} = nothing; kw...)

Draws a vertical line at position x (and optional y values).

source
UnicodePlots.xlabel!Method
xlabel!(plot, newlabel)

Sets a new x-label for the given plot. Alternatively, the current label can be queried using xlabel.

source
UnicodePlots.xlabelMethod
xlabel(plot) -> String

Returns the current label for the x-axis. Alternatively, the x-label can be changed with xlabel!.

source
UnicodePlots.ylabel!Method
ylabel!(plot, newlabel)

Sets a new y-label for the given plot. Alternatively, the current label can be queried using ylabel

source
UnicodePlots.ylabelMethod
ylabel(plot) -> String

Returns the current label for the y-axis. Alternatively, the y-label can be changed with ylabel!.

source
UnicodePlots.zlabel!Method
zlabel!(plot, newlabel)

Sets a new z-label (colorbar label) for the given plot. Alternatively, the current label can be queried using zlabel.

source
UnicodePlots.zlabelMethod
zlabel(plot) -> String

Returns the current label for the z-axis (colorbar). Alternatively, the z-label can be changed with zlabel!.

source