API
Autogenerated docstrings
UnicodePlots.AsciiCanvas
— TypeAs 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.
UnicodePlots.BarplotGraphics
— TypeBarplotGraphics
Structure to hold bar based graphics.
UnicodePlots.BlockCanvas
— TypeThe 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.
UnicodePlots.BoxplotGraphics
— TypeBoxplotGraphics
Structure to hold box based graphics.
UnicodePlots.BrailleCanvas
— TypeThe 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.
UnicodePlots.DensityCanvas
— TypeUnlike 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.
UnicodePlots.DotCanvas
— TypeSimilar 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.
UnicodePlots.HeatmapCanvas
— TypeThe 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).
UnicodePlots.ImageGraphics
— TypeImageGraphics
Structure to hold an image.
UnicodePlots.LookupCanvas
— TypeSupertype for Look-Up Table (LUT) encoded canvases.
UnicodePlots.MVP
— TypeMVP(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
.
UnicodePlots.MVP
— Methodtransform a matrix of points, with allocation
UnicodePlots.MVP
— Methodtransform a vector
UnicodePlots.MVP
— Methodinplace transform
UnicodePlots.Plot
— TypePlot(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
: theGraphicsArea
(e.g. a subtype ofCanvas
) 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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots._show
— MethodDisplay a Plot
object to a terminal emulator.
UnicodePlots.annotate!
— Methodannotate!(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 provide3
integers asRGB
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
UnicodePlots.arguments
— Functionarguments([desc]; default = DEFAULT_KW, add = (), exclude = DEFAULT_EXCLUDED, remove = ())
Defines arguments for docstring genreration.
Arguments
desc::NamedTuple
: add argument description in the formarg = desc
.default::Tuple
: defaultUnicodePlots
keywords.add::Tuple
: add extra symbols, not listed indefault
but present inDESCRIPTION
.remove::Tuple
: remove symbols fromdefault
.
UnicodePlots.barplot!
— Methodbarplot(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 astext
and the values will be used asheights
.xscale::Symbol = :identity
:Function
orSymbol
to transform the bar length before plotting: this effectively scales thex
-axis without influencing the captions of the individual bars (usexscale = :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 provide3
integers asRGB
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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.compact::Bool = false
: compress the plot (compact labels, removes margins and padding).unicode_exponent::Bool = true
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.barplot
— Methodbarplot(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 astext
and the values will be used asheights
.xscale::Symbol = :identity
:Function
orSymbol
to transform the bar length before plotting: this effectively scales thex
-axis without influencing the captions of the individual bars (usexscale = :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 provide3
integers asRGB
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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.compact::Bool = false
: compress the plot (compact labels, removes margins and padding).unicode_exponent::Bool = true
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.boxplot!
— Methodboxplot(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 astext
and the values will be used asdata
.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 provide3
integers asRGB
components.title::String = ""
: text displayed on top of the plot.name::String = ""
: current drawing annotation displayed on the right.xlabel::String = ""
: text displayed on thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.compact::Bool = false
: compress the plot (compact labels, removes margins and padding).unicode_exponent::Bool = true
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.boxplot
— Methodboxplot(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 astext
and the values will be used asdata
.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 provide3
integers asRGB
components.title::String = ""
: text displayed on top of the plot.name::String = ""
: current drawing annotation displayed on the right.xlabel::String = ""
: text displayed on thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.compact::Bool = false
: compress the plot (compact labels, removes margins and padding).unicode_exponent::Bool = true
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.contourplot!
— Methodcontourplot(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, orFunction
evaluated asf(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
axis of the plot.zlabel::String = ""
: text displayed on thez
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.zlim::Tuple = (0, 0)
: colormap scaled data range.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.colorbar::Bool = false
: toggle the colorbar.colormap::Symbol = :viridis
: choose a symbol fromColorSchemes.jl
e.g.:viridis
, or supply a functionf: (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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.contourplot
— Methodcontourplot(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
UnicodePlots.contourplot
— Methodcontourplot(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, orFunction
evaluated asf(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
axis of the plot.zlabel::String = ""
: text displayed on thez
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.zlim::Tuple = (0, 0)
: colormap scaled data range.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.colorbar::Bool = false
: toggle the colorbar.colormap::Symbol = :viridis
: choose a symbol fromColorSchemes.jl
e.g.:viridis
, or supply a functionf: (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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.ctr_len_diag
— Methodctr_len_diag(x, y, z)
Description
Computes data center, minimum and maximum points, and cube diagonal length.
UnicodePlots.default_size!
— Methoddefault_size!(;
height::Union{Integer,Nothing} = nothing,
width::Union{Integer,Nothing} = nothing,
)
Change and return the default plot size (height, width).
UnicodePlots.densityplot!
— Methoddensityplot(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.compact::Bool = false
: compress the plot (compact labels, removes margins and padding).unicode_exponent::Bool = true
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.densityplot
— Methoddensityplot(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.compact::Bool = false
: compress the plot (compact labels, removes margins and padding).unicode_exponent::Bool = true
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.draw_axes!
— Methoddraw_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.
UnicodePlots.frustum
— Methodfrustum(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.
UnicodePlots.heatmap
— Methodheatmap(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 they
coordinate labels (defaults to 0 - i.e. each row inA
maps to one unit,y
origin starting at 1). If set to anything else, the y origin will start at 0.xfact
: scale for thex
coordinate (defaults to 0 - i.e. each column inA
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 they
coordinate (after scaling).xoffset
: plotting offset for thex
coordinate (after scaling).array
: use array display convention (origin at the North-West corner of the plot, hence flippingy
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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
axis of the plot.zlabel::String = ""
: text displayed on thez
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.zlim::Tuple = (0, 0)
: colormap scaled data range.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.colorbar::Bool = false
: toggle the colorbar.colormap::Symbol = :viridis
: choose a symbol fromColorSchemes.jl
e.g.:viridis
, or supply a functionf: (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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.histogram
— Methodhistogram(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.hline!
— Functionhline!(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).
UnicodePlots.hline!
— Functionhline!(plot::Plot{<:Canvas}, y::Number, x::Union{AbstractVector{<:Number},Nothing} = nothing; kw...)
Draws an horizontal line at position y
(and optional x
values).
UnicodePlots.horizontal_histogram
— Methodhorizontal_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 fittedStatsBase.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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^2.1
.blend::Bool = true
: blend colors on the underlying canvas.
UnicodePlots.imageplot
— Methodimageplot(img; kw...)
Plot an image using ImageInTerminal
(sixel
s 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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.isosurface!
— Methodisosurface(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, orFunction
evaluated asf(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
axis of the plot.zlabel::String = ""
: text displayed on thez
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.zlim::Tuple = (0, 0)
: colormap scaled data range.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.colorbar::Bool = false
: toggle the colorbar.colormap::Symbol = :viridis
: choose a symbol fromColorSchemes.jl
e.g.:viridis
, or supply a functionf: (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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^2.1
.projection::Symbol = :orthographic
: projection for 3D plots (:ortho(graphic)
,:persp(ective)
, orModel-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 thefloor
plane (-90 ≤ θ ≤ 90
).azimuth::Float = 45.0
: azimutal angle around theup
vector (-180° ≤ φ ≤ 180°
).zoom::Float = 1.0
: zooming factor in 3D.up::Symbol = :z
: up vector (:x
,:y
or:z
), prefix withm -> -
orp -> +
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
UnicodePlots.isosurface
— Methodisosurface(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, orFunction
evaluated asf(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
axis of the plot.zlabel::String = ""
: text displayed on thez
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.zlim::Tuple = (0, 0)
: colormap scaled data range.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.colorbar::Bool = false
: toggle the colorbar.colormap::Symbol = :viridis
: choose a symbol fromColorSchemes.jl
e.g.:viridis
, or supply a functionf: (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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^2.1
.projection::Symbol = :orthographic
: projection for 3D plots (:ortho(graphic)
,:persp(ective)
, orModel-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 thefloor
plane (-90 ≤ θ ≤ 90
).azimuth::Float = 45.0
: azimutal angle around theup
vector (-180° ≤ φ ≤ 180°
).zoom::Float = 1.0
: zooming factor in 3D.up::Symbol = :z
: up vector (:x
,:y
or:z
), prefix withm -> -
orp -> +
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
UnicodePlots.keywords
— Functionkeywords([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 formkeyword = value
.default::Tuple
: defaultUnicodePlots
keywords.add::Tuple
: add extra symbols, not listed indefault
but present inKEYWORDS
.remove::Tuple
: remove symbols fromdefault
.
UnicodePlots.label!
— Methodlabel!(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.
UnicodePlots.lineplot
— Functionlineplot(; 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 fromstart
tostop
(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. provide0.1
for 10%).x
: horizontal position for each point (can be a real number or of typeTimeType
), if omitted, the axes ofy
will be used asx
.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 provide3
integers asRGB
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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.lineplot!
— Functionlineplot(; 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 fromstart
tostop
(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. provide0.1
for 10%).x
: horizontal position for each point (can be a real number or of typeTimeType
), if omitted, the axes ofy
will be used asx
.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 provide3
integers asRGB
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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.lookat
— Functionlookat(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]).
UnicodePlots.ortho
— Methodortho(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.
UnicodePlots.pixel_size
— Methodpixel_size(c::Canvas)
Canvas pixel resolution (height, width).
UnicodePlots.png_image
— Methodpng_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).
UnicodePlots.polarplot!
— Methodpolarplot(θ, 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, orFunction
evaluated asr(θ)
.rlim
: plotting range for ther
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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.polarplot
— Methodpolarplot(θ, 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, orFunction
evaluated asr(θ)
.rlim
: plotting range for ther
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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.preprocess!
— Methodpreprocess!(c::GraphicsArea)
Optional step: pre-process canvas before printing rows (e.g. for costly computations). Returns a callback for optional cleanup after printing.
UnicodePlots.savefig
— Methodsavefig(p, filename; color = false, kw...)
Save the given plot to a txt or
png` 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)
UnicodePlots.scatterplot
— Functionscatterplot(; 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), aChar
, a unit lengthString
or aVector
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 provide3
integers asRGB
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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.scatterplot!
— Functionscatterplot(; 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), aChar
, a unit lengthString
or aVector
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 provide3
integers asRGB
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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.spy
— Methodspy(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.stairs!
— Methodstairs(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.stairs
— Methodstairs(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^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
UnicodePlots.surfaceplot!
— Functionsurfaceplot(x, y, A; kw...)
surfaceplot!(p, args...; kw...)
Draws a 3D surface plot on a new canvas (masking values using NaN
s 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, orFunction
evaluated asf(x, y)
.lines
: uselineplot
instead ofscatterplot
(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
axis of the plot.zlabel::String = ""
: text displayed on thez
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.zlim::Tuple = (0, 0)
: colormap scaled data range.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.colorbar::Bool = false
: toggle the colorbar.colormap::Symbol = :viridis
: choose a symbol fromColorSchemes.jl
e.g.:viridis
, or supply a functionf: (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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^2.1
.projection::Symbol = :orthographic
: projection for 3D plots (:ortho(graphic)
,:persp(ective)
, orModel-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 thefloor
plane (-90 ≤ θ ≤ 90
).azimuth::Float = 45.0
: azimutal angle around theup
vector (-180° ≤ φ ≤ 180°
).zoom::Float = 1.0
: zooming factor in 3D.up::Symbol = :z
: up vector (:x
,:y
or:z
), prefix withm -> -
orp -> +
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
UnicodePlots.surfaceplot
— Methodsurfaceplot(A; kw...)
Usage
Draws a surface plot of matrix A
along axis x
and y
on a new canvas.
UnicodePlots.surfaceplot
— Methodsurfaceplot(x, y, A; kw...)
surfaceplot!(p, args...; kw...)
Draws a 3D surface plot on a new canvas (masking values using NaN
s 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, orFunction
evaluated asf(x, y)
.lines
: uselineplot
instead ofscatterplot
(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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
axis of the plot.zlabel::String = ""
: text displayed on thez
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.zlim::Tuple = (0, 0)
: colormap scaled data range.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
axis.colorbar::Bool = false
: toggle the colorbar.colormap::Symbol = :viridis
: choose a symbol fromColorSchemes.jl
e.g.:viridis
, or supply a functionf: (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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^2.1
.projection::Symbol = :orthographic
: projection for 3D plots (:ortho(graphic)
,:persp(ective)
, orModel-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 thefloor
plane (-90 ≤ θ ≤ 90
).azimuth::Float = 45.0
: azimutal angle around theup
vector (-180° ≤ φ ≤ 180°
).zoom::Float = 1.0
: zooming factor in 3D.up::Symbol = :z
: up vector (:x
,:y
or:z
), prefix withm -> -
orp -> +
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
UnicodePlots.title!
— Methodtitle!(plot, newtitle)
Sets a new title for the given plot. Alternatively, the current title can be queried using title
.
UnicodePlots.title
— Methodtitle(plot) -> String
Returns the current title of the given plot. Alternatively, the title can be changed with title!
.
UnicodePlots.validate_input
— Methodvalidate_input(x, y, z = nothing)
Description
Check for invalid input (length) and selects only finite input data.
UnicodePlots.vertical_histogram
— Methodvertical_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 fittedStatsBase.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 thex
axis of the plot.ylabel::String = ""
: text displayed on they
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 thex
axis ((0, 0)
stands for automatic).ylim::Tuple = (0, 0)
: plotting range for they
axis.xflip::Bool = false
: settrue
to flip thex
axis.yflip::Bool = false
: settrue
to flip they
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
: useUnicode
symbols for exponents: e.g.10²⸱¹
instead of10^2.1
.blend::Bool = true
: blend colors on the underlying canvas.
UnicodePlots.vline!
— Functionvline!(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).
UnicodePlots.vline!
— Functionvline!(plot::Plot{<:Canvas}, x::Number, y::Union{AbstractVector{<:Number},Nothing} = nothing; kw...)
Draws a vertical line at position x
(and optional y
values).
UnicodePlots.xlabel!
— Methodxlabel!(plot, newlabel)
Sets a new x-label for the given plot. Alternatively, the current label can be queried using xlabel
.
UnicodePlots.xlabel
— Methodxlabel(plot) -> String
Returns the current label for the x-axis. Alternatively, the x-label can be changed with xlabel!
.
UnicodePlots.ylabel!
— Methodylabel!(plot, newlabel)
Sets a new y-label for the given plot. Alternatively, the current label can be queried using ylabel
UnicodePlots.ylabel
— Methodylabel(plot) -> String
Returns the current label for the y-axis. Alternatively, the y-label can be changed with ylabel!
.
UnicodePlots.zlabel!
— Methodzlabel!(plot, newlabel)
Sets a new z-label (colorbar label) for the given plot. Alternatively, the current label can be queried using zlabel
.
UnicodePlots.zlabel
— Methodzlabel(plot) -> String
Returns the current label for the z-axis (colorbar). Alternatively, the z-label can be changed with zlabel!
.