Giter Club home page Giter Club logo

unicodeplots.jl's Introduction

UnicodePlots

License PkgEval CI Coverage Status JuliaHub deps UnicodePlots Downloads

Advanced Unicode plotting library designed for use in Julia's REPL.

High-level Interface

Here is a list of the main high-level functions for common scenarios:

Introduction

Here is a quick hello world example of a typical use-case:

using UnicodePlots
lineplot([-1, 2, 3, 7], [-1, 2, 9, 4], title="Example", name="my line", xlabel="x", ylabel="y")


There are other types of Canvas available (see section Low-level Interface).

In some situations, such as printing to a file, using AsciiCanvas, DotCanvas or BlockCanvas might lead to better results:

plt = lineplot([-1, 2, 3, 7], [-1, 2, 9, 4], title="Example", name="my line",
               xlabel="x", ylabel="y", canvas=DotCanvas, border=:ascii)


Some plot methods have a mutating variant that ends with an exclamation mark:

lineplot!(plt, [0, 4, 8], [10, 1, 10], color=:cyan, name="other line")


These mutating methods cannot update the limits of the axes as plots are drawn onto a fixed canvas. The limits must be set beforehand by the plotting function that creates the figure or by creating an empty Plot:

p = Plot(; xlim=(-1, 3), ylim=(-1, 3))
lineplot!(p, 1:2)


One can adjust the plot height and width to the current terminal size by using height=:auto and/or width=:auto.

You can reverse/flip the Plot axes by setting xflip=true and/or yflip=true on plot creation.

Lineplot
lineplot([1, 2, 7], [9, -6, 8], title="My Lineplot")


It's also possible to specify a function and a range:

plt = lineplot(-π/2, 2π, [cos, sin])


You can also plot lines by specifying an intercept and slope:

lineplot!(plt, -.5, .2, name="line")


Plotting multiple series is supported by providing a Matrix (<: AbstractMatrix) for the y argument, with the individual series corresponding to its columns. Auto-labeling is by default, but you can also label each series by providing a Vector or a 1xn Matrix such as ["series 1" "series2" ...]:

lineplot(1:10, [0:9 3:12 reverse(5:14) fill(4, 10)], color=[:green :red :yellow :cyan])


Physical quantities of Unitful.jl are supported through package extensions - weak dependencies:

using Unitful
a, t = 1u"m/s^2", (0:100) * u"s"
lineplot(a / 2 * t .^ 2, a * t, xlabel="position", ylabel="speed", height=10)


Intervals from IntervalSets.jl are supported:

using IntervalSets
lineplot(-1..3, x -> x^5 - 5x^4 + 5x^3 + 5x^2 - 6x - 1; name="quintic")


Use head_tail to mimic plotting arrows (:head, :tail or :both) where the length of the "arrow" head or tail is controlled using head_tail_frac where e.g. giving a value of 0.1 means 10% of the segment length:

lineplot(1:10, 1:10, head_tail=:head, head_tail_frac=.1, height=4)


UnicodePlots exports hline! and vline! for drawing vertical and horizontal lines on a plot:

p = Plot([NaN], [NaN]; xlim=(0, 8), ylim=(0, 8))
vline!(p, [2, 6], [2, 6], color=:red)
hline!(p, [2, 6], [2, 6], color=:white)
hline!(p, 7, color=:cyan)
vline!(p, 1, color=:yellow)


Scatterplot
scatterplot(randn(50), randn(50), title="My Scatterplot")


Axis scaling (xscale and/or yscale) is supported: choose from (:identity, :ln, :log2, :log10) or use an arbitrary scale function:

scatterplot(1:10, 1:10, xscale=:log10, yscale=:log10)


For the axis scale exponent, one can revert to using ASCII characters instead of Unicode ones using the keyword unicode_exponent=false:

scatterplot(1:4, 1:4, xscale=:log10, yscale=:ln, unicode_exponent=false, height=6)


Using a marker is supported, choose a Char, a unit length String or a symbol name such as :circle (more from keys(UnicodePlots.MARKERS)). One can also provide a vector of markers and/or colors as in the following example:

scatterplot([1, 2, 3], [3, 4, 1], marker=[:circle, '', ""],
            color=[:cyan, nothing, :yellow], height=2)


As with lineplot, scatterplot supports plotting physical Unitful quantities, or plotting multiple series (Matrix argument).

Staircase plot
stairs([1, 2, 4, 7, 8], [1, 3, 4, 2, 7],
       color=:yellow, style=:post, height=6, title="Staircase")


Barplot
barplot(["Paris", "New York", "Madrid"], [2.244, 8.406, 3.165], title="Population")


Note: You can use the keyword argument symbols to specify the characters that should be used to plot the bars (e.g. symbols=['#']).

Histogram
histogram(randn(1_000) .* .1, nbins=15, closed=:left)


The histogram function also supports axis scaling using the parameter xscale:

histogram(randn(1_000) .* .1, nbins=15, closed=:right, xscale=:log10)


Vertical histograms are supported:

histogram(randn(100_000) .* .1, nbins=60, vertical=true, height=10)


Boxplot
boxplot([1, 3, 3, 4, 6, 10])


boxplot(["one", "two"],
        [[1, 2, 3, 4, 5], [2, 3, 4, 5, 6, 7, 8, 9]],
        title="Grouped Boxplot", xlabel="x")


Sparsity Pattern
using SparseArrays
spy(sprandn(50, 120, .05))


Plotting the zeros pattern is also possible using show_zeros=true:

using SparseArrays
spy(sprandn(50, 120, .9), show_zeros=true)


Density Plot
plt = densityplot(randn(10_000), randn(10_000))
densityplot!(plt, randn(10_000) .+ 2, randn(10_000) .+ 2)


Using a scale function (e.g. damping peaks) is supported using the dscale keyword:

x = randn(10_000); x[1_000:6_000] .= 2
densityplot(x, randn(10_000); dscale=x -> log(1 + x))


Contour Plot
contourplot(-3:.01:3, -7:.01:3, (x, y) -> exp(-(x / 2)^2 - ((y + 2) / 4)^2))


The keyword levels controls the number of contour levels. One can also choose a colormap as with heatmap, and disable the colorbar using colorbar=false.

Polar Plot

Plots data in polar coordinates with θ the angles in radians.

polarplot(range(0, 2π, length=20), range(0, 2, length=20))


Heatmap Plot
heatmap(repeat(collect(0:10)', outer=(11, 1)), zlabel="z")


The heatmap function also supports axis scaling using the parameters xfact, yfact and axis offsets after scaling using xoffset and yoffset.

The colormap parameter may be used to specify a named or custom colormap. See the heatmap function documentation for more details.

In addition, the colorbar and colorbar_border options may be used to toggle the colorbar and configure its border.

The zlabel option and zlabel! method may be used to set the z axis (colorbar) label.

Use the array keyword in order to display the matrix in the array convention (as in the repl).

heatmap(collect(0:30) * collect(0:30)', xfact=.1, yfact=.1, xoffset=-1.5, colormap=:inferno)


Image Plot

Draws an image, surround it with decorations. Sixel are supported (experimental) under a compatible terminal through ImageInTerminal (which must be imported before UnicodePlots).

import ImageInTerminal  # mandatory (triggers glue code loading)
using TestImages
imageplot(testimage("monarch_color_256"), title="monarch")


Surface Plot

Plots a colored surface using height values z above a x-y plane, in three dimensions (masking values using NaNs is supported).

sombrero(x, y) = 15sinc((x^2 + y^2) / π)
surfaceplot(-8:.5:8, -8:.5:8, sombrero, colormap=:jet)


Use lines=true to increase the density (underlying call to lineplot instead of scatterplot, with color interpolation). By default, surfaceplot scales heights to adjust aspect wrt the remaining axes with zscale=:aspect. To plot a slice in 3D, use an anonymous function which maps to a constant value: zscale=z -> a_constant:

surfaceplot(
  -2:2, -2:2, (x, y) -> 15sinc((x^2 + y^2) / π),
  zscale=z -> 0, lines=true, colormap=:jet
)


Isosurface Plot

Uses MarchingCubes.jl to extract an isosurface, where isovalue controls the surface isovalue. Using centroid enables plotting the triangulation centroids instead of the triangle vertices (better for small plots). Back face culling (hide not visible facets) can be activated using cull=true. One can use the legacy 'Marching Cubes' algorithm using legacy=true.

torus(x, y, z, r=0.2, R=0.5) = ((x^2 + y^2) - R)^2 + z^2 - r^2
isosurface(-1:.1:1, -1:.1:1, -1:.1:1, torus, cull=true, zoom=2, elevation=50)


Documentation

Installation
...

To install UnicodePlots, start up Julia and type the following code snippet into the REPL (makes use of the native Julia package manager Pkg):

julia> using Pkg
julia> Pkg.add("UnicodePlots")
Saving figures
...

Saving plots as png or txt files using the savefig command is supported (saving as png is experimental and requires import FreeType, FileIO before loading UnicodePlots).

To recover the plot as a string with ansi color codes use string(p; color=true).

Color mode
...

When the COLORTERM environment variable is set to either 24bit or truecolor, UnicodePlots will use 24bit colors as opposed to 8bit colors or even 4bit colors for named colors.

One can force a specific colormode using either UnicodePlots.truecolors!() or UnicodePlots.colors256!().

Named colors such as :red or :light_red will use 256 color values (rendering will be terminal dependent). In order to force named colors to use true colors instead, use UnicodePlots.USE_LUT[]=true.

The default color cycle can be changed to bright (high intensity) colors using UnicodePlots.brightcolors!() instead of the default UnicodePlots.faintcolors!().

3D plots
...

3d plots use a so-called "Model-View-Projection" transformation matrix MVP on input data to project 3D plots to a 2D screen.

Use keywordselevation, azimuth, up or zoom to control the view matrix, a.k.a. camera.

The projection type for MVP can be set to either :persp(ective) or :ortho(graphic).

Displaying the x, y, and z axes can be controlled using the axes3d keyword.

For enhanced resolution, use a wider and/or taller Plot (this can be achieved using default_size!(width=60) for all future plots).

Layout
...

UnicodePlots is integrated in Plots as a backend, with support for basic layout.

For a more complex layout, use the gridplot function (requires loading Term as extension).

using UnicodePlots, Term

(
  UnicodePlots.panel(lineplot(1:2)) *
  UnicodePlots.panel(scatterplot(rand(100)))
) / (
  UnicodePlots.panel(lineplot(2:-1:1)) * 
  UnicodePlots.panel(densityplot(randn(1_000), randn(1_000)))
) |> display

gridplot(map(i -> lineplot(-i:i), 1:5); show_placeholder=true) |> display
gridplot(map(i -> lineplot(-i:i), 1:3); layout=(2, nothing)) |> display
gridplot(map(i -> lineplot(-i:i), 1:3); layout=(nothing, 1)) |> display
Known issues
...

Using a non true monospace font can lead to visual problems on a BrailleCanvas (border versus canvas).

Either change the font to e.g. JuliaMono or use border=:dotted keyword argument in the plots.

For a Jupyter notebook with the IJulia kernel see here.

(Experimental) Terminals seem to respect a standard aspect ratio of 4:3, hence a square matrix does not often look square in the terminal.

You can pass the experimental keyword fix_ar=true to spy or heatmap in order to recover a unit aspect ratio.

Methods (API)
...

Non-exhaustive methods description:

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

    • title the string to write in the top center of the plot window. If the title is empty the whole line of the title will not be drawn
  • xlabel!(plot::Plot, xlabel::String)

    • xlabel the string to display on the bottom of the plot window. If the title is empty the whole line of the label will not be drawn
  • ylabel!(plot::Plot, xlabel::String)

    • ylabel the string to display on the far left of the plot window.

The method label! is responsible for the setting all the textual decorations of a plot. It has two functions:

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

    • 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)
  • label!(plot::Plot, where::Symbol, row::Int, value::String)

    • where can be any of: :l (left), :r (right)

    • row can be between 1 and the number of character rows of the canvas

x = y = collect(1:10)
plt = lineplot(x, y, canvas=DotCanvas, height=10, width=30)
lineplot!(plt, x, reverse(y))
title!(plt, "Plot Title")
for loc in (:tl, :t, :tr, :bl, :b, :br)
  label!(plt, loc, string(':', loc))
end
label!(plt, :l, ":l")
label!(plt, :r, ":r")
for i in 1:10
  label!(plt, :l, i, string(i))
  label!(plt, :r, i, string(i))
end
plt


  • annotate!(plot::Plot, x::Number, y::Number, text::AbstractString; kw...)
    • text arbitrary annotation at position (x, y)
Keywords description (API)
...

All plots support the set (or a subset) of the following named parameters:

  • symbols::Array = ['■']: collection of characters used to render the bars.

  • title::String = "": text displayed on top of the plot.

  • name::String = "": current drawing annotation displayed on the right.

  • xlabel::String = "": text displayed on the x axis of the plot.

  • ylabel::String = "": text displayed on the y axis of the plot.

  • zlabel::String = "": text displayed on the z axis (colorbar) of the plot.

  • xscale::Symbol = :identity: x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).

  • yscale::Symbol = :identity: y-axis scale.

  • labels::Bool = true: show plot labels.

    lineplot(1:.5:20, sin, labels=false)


  • border::Symbol = :solid: plot bounding box style (:corners, :solid, :bold, :dashed, :dotted, :ascii, :none).

    lineplot([-1., 2, 3, 7], [1.,2, 9, 4], canvas=DotCanvas, border=:dashed)


    lineplot([-1., 2, 3, 7], [1.,2, 9, 4], canvas=DotCanvas, border=:ascii)


    lineplot([-1., 2, 3, 7], [1.,2, 9, 4], canvas=DotCanvas, border=:bold)


    lineplot([-1., 2, 3, 7], [1.,2, 9, 4], border=:dotted)


    lineplot([-1., 2, 3, 7], [1.,2, 9, 4], border=: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.

  • color::Symbol = :auto: choose from (:green, :blue, :red, :yellow, :cyan, :magenta, :white, :normal, :auto), use an integer in [0-255], or provide 3 integers as RGB components.

  • height::Int = 15: number of canvas rows, or :auto.

    lineplot(1:.5:20, sin, height=18)


  • width::Int = 40: number of characters per canvas row, or :auto.

    lineplot(1:.5:20, sin, width=60)


  • xlim::Tuple = (0, 0): plotting range for the x axis ((0, 0) stands for automatic).

  • ylim::Tuple = (0, 0): plotting range for the y axis.

  • zlim::Tuple = (0, 0): colormap scaled data range.

  • xticks::Bool = true: set false to disable ticks (labels) on x-axis.

  • yticks::Bool = true: set false to disable ticks (labels) on y-axis.

  • xflip::Bool = false: set true to flip the x axis.

  • yflip::Bool = false: set true to flip the y axis.

  • colorbar::Bool = false: toggle the colorbar.

  • colormap::Symbol = :viridis: choose a symbol from ColorSchemes.jl e.g. :viridis, or supply a function f: (z, zmin, zmax) -> Int(0-255), or a vector of RGB tuples.

  • colorbar_lim::Tuple = (0, 1): colorbar limit.

  • colorbar_border::Symbol = :solid: color bar bounding box style (:solid, :bold, :dashed, :dotted, :ascii, :none).

  • canvas::UnionAll = BrailleCanvas: type of canvas used for drawing.

  • grid::Bool = true: draws grid-lines at the origin.

  • compact::Bool = false: compact plot labels.

  • unicode_exponent::Bool = true: use Unicode symbols for exponents: e.g. 10²⸱¹ instead of 10^2.1.

  • thousands_separator::Char = ' ': thousands separator character (use Char(0) to disable grouping digits).

  • projection::Symbol = :orthographic: projection for 3D plots (:ortho(graphic), :persp(ective), or Model-View-Projection (MVP) matrix).

  • axes3d::Bool = true: draw 3d axes (x -> :red, y -> :green, z -> :blue).

  • elevation::Float = 35.264389682754654: elevation angle above or below the floor plane (-90 ≤ θ ≤ 90).

  • azimuth::Float = 45.0: azimutal angle around the up vector (-180° ≤ φ ≤ 180°).

  • zoom::Float = 1.0: zooming factor in 3D.

  • up::Symbol = :z: up vector (:x, :y or :z), prefix with m -> - or p -> + to change the sign e.g. :mz for -z axis pointing upwards.

  • near::Float = 1.0: distance to the near clipping plane (:perspective projection only).

  • far::Float = 100.0: distance to the far clipping plane (:perspective projection only).

  • canvas_kw::NamedTuple = NamedTuple(): extra canvas keywords.

  • blend::Bool = true: blend colors on the underlying canvas.

  • fix_ar::Bool = false: fix terminal aspect ratio (experimental).

  • visible::Bool = true: visible canvas.

Note: If you want to print the plot into a file but have monospace issues with your font, you should probably try setting border=:ascii and canvas=AsciiCanvas (or canvas=DotCanvas for scatterplots).

Low-level interface
...

The primary structures that do all the heavy lifting behind the curtain are subtypes of Canvas. A canvas is a graphics object for rasterized plotting. Basically, it uses Unicode characters to represent pixel.

Here is a simple example:

import UnicodePlots: lines!, points!, pixel!
canvas = BrailleCanvas(15, 40,                    # number of rows and columns (characters)
                       origin_y=0., origin_x=0.,  # position in virtual space
                       height=1., width=1.)       # size of the virtual space
lines!(canvas, 0., 0., 1., 1.; color=:cyan)       # virtual space
points!(canvas, rand(50), rand(50); color=:red)   # virtual space
lines!(canvas, 0., 1., .5, 0.; color=:yellow)     # virtual space
pixel!(canvas, 5, 8; color=:red)                  # pixel space
Plot(canvas)


You can access the height and width of the canvas (in characters) with nrows(canvas) and ncols(canvas) respectively. You can use those functions in combination with print_row to embed the canvas anywhere you wish. For example, print_row(STDOUT, canvas, 3) writes the third character row of the canvas to the standard output.

As you can see, one issue that arises when multiple pixel are represented by one character is that it is hard to assign color. That is because each of the "pixel" of a character could belong to a different color group (each character can only have a single color). This package deals with this using a color-blend for the whole group. You can disable canvas color blending / mixing by passing blend=false to any function.

import UnicodePlots: lines!
canvas = BrailleCanvas(15, 40; origin_y=0., origin_x=0., height=1., width=1.)
lines!(canvas, 0., 0., 1., 1.; color=:cyan)
lines!(canvas, .25, 1., .5, 0.; color=:yellow)
lines!(canvas, .2, .8, 1., 0.; color=:red)
Plot(canvas)


The following types of Canvas are implemented:

  • BrailleCanvas: This type of canvas is probably the one with the highest resolution for Unicode plotting. It essentially uses the Unicode characters of the Braille symbols as pixels. This effectively turns every character into eight pixels that can individually be manipulated using binary operations.

  • BlockCanvas: This canvas 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.

  • HeatmapCanvas: This canvas is also Unicode based. It has half the resolution of the BlockCanvas. This canvas effectively turns every character into two color pixels, using the foreground and background terminal colors. As such, the number of rows of the canvas is half the number of y coordinates being displayed.

  • AsciiCanvas and DotCanvas: These two canvas utilizes only standard ASCII character for drawing. 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.

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

  • BarplotGraphics: This graphics area is special in that it does not support any pixel manipulation. It is essentially the barplot without decorations but the numbers. It does only support one method addrow! which allows the user to add additional bars to the graphics object.

Developer notes
...

Because Julia uses column-major indexing order for an array type, and because displaying data on a terminal is row based, we need an internal buffer compatible with efficient columns based iteration. We solve this by using the transpose of a (width, height) array for indexing into an internal buffer like buf[row, col] or buf[y, x]. Common users of UnicodePlots don't need to be aware of this axis difference if sticking to public interface.

p = Plot([NaN], [NaN]; xlim=(1, 10), ylim=(1, 10), title="internal buffer conventions")

# plot axes
vline!(p, 1, head_tail=:head, color=:green, name="y-axis (rows)")
hline!(p, 1, head_tail=:head, color=:red, name="x-axis (cols)")

# square
vline!(p, 2, [2, 9], color=:cyan, name="buf[y, x] - buf[row, col]")
vline!(p, [2, 9], [2, 9], color=:cyan)
hline!(p, [2, 9], [2, 9], color=:cyan)

# internal axes
vline!(p, 3, range(3, 8; length=20), head_tail=:tail, color=:light_green, name="y-buffer (rows)")
hline!(p, 8, range(3, 8; length=20), head_tail=:head, color=:light_red, name="x-buffer (cols)")

# mem layout
vline!(p, 4, [4, 7]; color=:yellow, name="memory layout")
vline!(p, 7, [4, 7]; color=:yellow)
hline!(p, [4, 7], [4, 7]; color=:yellow)
hline!(p, [4.5, 5, 5.5, 6], [4.5, 6.5]; color=:yellow)


Invalidations check
...

Run the following snippet to analyze invalidations:

using SnoopCompileCore

invalidations = @snoopr using UnicodePlots
tinf = @snoopi_deep UnicodePlots.precompile_workload()

using SnoopCompile, AbstractTrees, PrettyTables  # must occur after `invalidations`

print_tree(tinf; maxdepth = typemax(Int))

trees = invalidation_trees(invalidations)
trees = filtermod(UnicodePlots, trees; recursive = true)

@show length(uinvalidated(invalidations))  # all invalidations

# only from `UnicodePlots`
@show length(staleinstances(tinf))
@show length(trees)

SnoopCompile.report_invalidations(;
   invalidations,
   process_filename = x -> last(split(x, ".julia/packages/")),
   n_rows = 0,
)
Documentation update
...

The following snippet:

$ cd docs
$ julia gen_docs.jl
$ (cd imgs; julia gen_imgs.jl)

will regenerate README.md and the example images with root (prefix) url https://github.com/JuliaPlots/UnicodePlots.jl/raw/unicodeplots-docs.

License

This code is free to use under the terms of the MIT license.

Acknowledgement

Inspired by TextPlots.jl, which in turn was inspired by Drawille.

unicodeplots.jl's People

Contributors

adamslc avatar aminnj avatar anderson15 avatar andreasnoack avatar beastyblacksmith avatar drdaleks avatar evizero avatar github-actions[bot] avatar ianbutterworth avatar jakebolewski avatar jiahao avatar johnnychen94 avatar juliohm avatar lopezm94 avatar mgtlake avatar michaelhatherly avatar milankl avatar mtfishman avatar paulms avatar rjkat avatar rkurchin avatar ronisbr avatar simonbyrne avatar socob avatar t-bltg avatar timholy avatar trevor avatar waldyrious avatar wookay avatar zsoerenm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unicodeplots.jl's Issues

createPlotWindow missing

I just realized that the UnicodePlots backend is broken in Plots.jl. It can't find UnicodePlots.createPlotWindow... what's the new method I should use for this?

Support plotting time series

Something along the lines of ...

function lineplot{T<:TimeType,R<:Real}(X::AbstractVector{T}, Y::AbstractVector{R};

This would require importing the Base.Dates package.

Feature: Histograms

How do you feel about histograms? I'm using this right now:

function histogram(x, n::Int=5)
    edges, counts = hist(x,n)
    labels = []
    for i in 1:length(counts)
        push!(labels, string("(",edges[i],",",edges[i]+1,"]"))
    end
    barplot(labels,counts)
end
num_over = [1,0,2,1,1,0,2,1,1,0,1,2,2,0,0,2,0,1,1,2,1,1,1,0,1,1,3,1,1,1,2,1,2,0,1,1,0,0,2,1,0,0,1,0,1,1,2,1,1,0,2,0,1,2,1,1,2,2,0,1,0,1,1,2,0,1,1,0,2,1,1,2,0,1,1,1,1,1,0,1,2,1,1,1,2,0,2,1,1,1,2,1,3,1,0,1,2,2,0,2,0,3,2,0,2,0,1,1,3,2,1,2,2,1,1,2,1,1,2,1,2,1,2,2,0,0,0,0,1,2,3,1,0,2,2,2,0,0,1,1,2,1,1,0,0,0,1,1,2,0,2,1,2,1,1,2,2,0,0,2,0,1,2,1,0,2,1,0,1,0,1,1,2,0,2,0,1,1,1,2,1,2,1,2,3,0,1,1,2,1,2,2,0,0,1,1,0,2,0,0,1,0,0,1,0,1,1,0,1,2,0,2,1,1,2,1,2,2,1,0,2,1,0,2,1,1,1,1,1,3,3,0,0,2,2,1,3,1,2,2,1,1,0,0,1,2,2,1,2,2,1,0,2,1,1,2,2,2,1,1,0,0,1,2,1,1,2,1,1,3,2,1,1,1,1,2,1,0,1,1,0,1,1,1,1,1,1,1,3,0,0,1,0,1,0,1,3,0,2,1,1,1,0,3,1,1,1,2,1,1,1,3,1,1,1,2,1,0,0,0,0,2,1,2,2,2,0,2,1,3,1,1,0,3,1,3,2,2,1,2,1,1,1,2,1,1,0,1,0,1,3,0,1,3,1,0,0,2,1,1,0,0,1,1,1,1,1,1,3,2,2,0,1,3,1,1,1,2,0,1,2,1,0,3,0,1,1,2,3,1,1,1,0,2,0,2,1,1,2,2,2,0,2,2,2,2,1,2,2,0,2,3,0,1,1,2,1,0,2,1,2,0,1,1,1,1,1,2,0,0,0,0,1,2,0,3,1,1,1,1,1,0,2,0,0,1,0,1,2,2,1,1,2,0,1,1,2,1,1,1,1,2,0,1,0,1,2,3,1,2,1,0,0,2,2,1,1,2,0,1,1,2,2,2,2,1,0,0,1,2,2,3,0,2,2,2,1,2,1,1,0,1,1,1,2,1,3,1,0,1,1,2,1,1,1,1,0,1,1,1,2,2,1,1,0,2,0,1,0,1,2,0,2,2,1,1,0,2,1,2,2,0,0,1,1,1,1,0,1,2,2,1,1,2,1,2,1,1,0,3,2,1,1,1,1,2,2,1,2,1,1,1,1,1,1,1,1,2,0,0,1,1,3,1,1,1,1,1,2,1,0,1,1,1,0,1,2,2,1,0,1,1,1,0,1,0,1,2,1,1,3,3,0,0,2,2,0,2,2,0,2,1,2,1,1,2,2,0,1,1,1,1,0,2,1,1,0,1,1,1,0,1,2,2,1,1,1,2,3,1,2,2,1,1,1,0,0,2,2,1,1,1,1,2,0,0,1,0,1,3,2,1,1,2,2,1,1,1,2,0,2,1,0,2,0,0,2,3,1,1,2,1,2,1,0,3,1,2,3,1,1,2,3,2,2,1,1,1,1,1,2,0,2,1,0,1,1,2,0,1,1,1,1,1,1,1,3,1,0,0,2,1,1,1,1,1,1,1,1,2,0,2,2,2,2,1,3,1,1,0,0,1,0,2,0,0,1,2,2,0,3,0,0,2,1,1,2,3,1,0,0,2,1,0,0,2,1,1,2,2,3,2,1,1,2,2,2,2,2,1,1,1,0,0,0,0,1,1,2,1,1,1,0,0,1,0,0,1,0,1,0,0,1,2,3,1,1,0,3,0,1,2,0,1,0,2,2,1,2,0,1,1,2,0,2,1,0,0,1,2,0,1,2,1,1,2,0,1,1,0,2,1,1,0,2,2,0,1,1,0,1,0,1,2,2,2,0,1,1,0,1,1,1,0,1,1,2,1,1,0,2,1,1,3,1,0,1,2,3,1,0,3,0,1,0,1,2,1,3,3,1,2,1,1,2,0,3,1,1,2,2,1,1,2,1,1,1,0,0,1,2,1,1,0,3,0,1,1,1,1,2,0,1,2,1,1,1,2,1,1,2,0,0,2,3,0,1,1,2,1,1,1,0,2,1,1,2,1,1,1,2,0,2,1,2,1,2,2,2,2,1,1,0,1,1,2,2,1,1,1,2,1,1,1,2,1,2,0,2,2,1,1,2,0,1,0,2,2,0,2]
histogram(num_over)
             ┌─────────────────────────────────────────────┐
   (-1.0,0.0]│▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪ 221                      │
    (0.0,1.0]│▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪ 460 │
    (1.0,2.0]│▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪ 266                  │
    (2.0,3.0]│▪▪▪▪▪ 53                                     │
             └─────────────────────────────────────────────┘

I was thinking of a vertical version, but it seems like it could be kind of space inefficient. Anyway, thought I'd share this for now.

Plots don't look quite as good in iterm

screen shot 2015-08-16 at 5 48 11 pm

I think iTerm has line spacing, which doesn't get taken account by the painting algorithm, so the lines look off. Maybe the algorithm can be accounted to adjust for that (of course there will always be some spacing) or maybe @gnachman has a suggestion for how to make this look better (not that there is a real need since with iTerm you can always just embed a real plot as an inline image - but still).

Modify canvas size

I'm not sure how practical this is but I would like it if I could increase the canvas size of a plot.

Integrate with TerminalUI.jl

I've been working on a general framework for building Terminal uis over at https://github.com/Keno/TerminalUI.jl. I'm mostly opening an issue here as an FYI,
since I don't know when I'll find the time to do the integration and TerminalUI is still very
much early alpha, but figured you may be interested, esp. since some of its terminal
features may come in handy for you.

Support for 256 colors.

Newest Julia master allows to use a number as the color and will then print in the corresponding 256 color palette. The argument type for color could hence be a bit relaxed if you want.

histogram bin labels are sometimes incorrect

The labels are sometimes correct, but other times they are out of order, or cover nonsensical ranges, so you may need to run these a few times to see the problem.

julia> histogram(rand(Int32, 10),bins=10)
                                ┌────────────────────────────────────────┐ 
                 (-2.0e9,5.0e8] │▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 1                   │ 
                 (-1.5e9,1.0e9] │▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 1                   │ 
                 (-1.0e9,1.5e9] │ 0                                      │ 
                 (-5.0e8,2.0e9] │ 0                                      │ 
                    (0.0,2.5e9] │▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 2 │ 
                  (5.0e8,3.0e9] │▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 1                   │ 
   (1.0e9,3.9999999999999995e9] │▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 2 │ 
   (1.5e9,3.9999999999999995e9] │▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 1                   │ 
                  (2.0e9,5.0e9] │▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 2 │ 
                                └────────────────────────────────────────┘ 
julia> histogram(rand(Float32, 10),bins=10)
                             ┌────────────────────────────────────────┐ 
   (0.30000000000000004,0.1] │▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 4 │ 
                   (0.4,0.2] │▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 2                   │ 
                   (0.5,0.3] │ 0                                      │ 
    (0.6000000000000001,0.4] │▇▇▇▇▇▇▇▇▇ 1                             │ 
    (0.7000000000000001,0.5] │▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 2                   │ 
                   (0.8,0.6] │ 0                                      │ 
                             └────────────────────────────────────────┘

versioninfo():

Julia Version 0.3.8-pre+22
Commit 5078421* (2015-04-28 09:05 UTC)
Platform Info:
  System: Linux (x86_64-amazon-linux)
  CPU: Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libmkl_rt
  LAPACK: libmkl_rt
  LIBM: libimf
  LLVM: libLLVM-3.3

Base on Compose.jl

So I have been thinking about automatic plot-resizing that stretches the size of the terminal (similar to how large arrays are printed in the REPL). To achieve this I would have to store the data to be drawn and delay the actual drawing on the canvas until show is called. This would enable all kinds of cool things though, such as being able to resize the "virtual space" of the plot when new data is added onto it.

If I were to do this refactoring, it would make sense to base this package on Compose.jl (I think). I don't believe the API of UnicodePlots would change that much (if at all), but the compile-time would probably increase.

I wouldn't do this big refactoring right away, but I thought I'd ask around what people think about this.

Does anyone have an opinion on this?

how to save as PNG?

I'm starting to look through this package for implementation in Plots.jl, but I can't figure out how you created the PNG files. Did you do that by hand? Any ideas of how to automate?

Tweak automatic plotting range a little

Although it is a lot better than before, I am still not really happy with it.

  • get happy about it by either finding a good solution or Stockholm syndrome
  • also include options to specify xlim and ylim

Stem Leaf Plot

How would you feel about adding a stem leaf plot? I think that with some changes to the barplot function we can have a sensible stem leaf plot.

One issue is that symb only takes one character. It would have to be changed to allow integers.

screen shot 2016-12-15 at 1 59 29 pm

filter deprecated warning

julia> unicodeplots()
Plots.UnicodePlotsBackend()

julia> plot( rand(3))
WARNING: filter(flt, itr) is deprecated, use Iterators.filter(flt, itr) instead.

DomainError when using histogram with Int64

Might be related to #14 .

julia> histogram(rand(Int64, 10),bins=10)
ERROR: DomainError
 in histrange at statistics.jl:555
 in histogram at /home/jbrock/.julia/v0.3/UnicodePlots/src/histogram.jl:4
 in histogram at /home/jbrock/.julia/v0.3/UnicodePlots/src/histogram.jl:14

versioninfo():

Julia Version 0.3.8-pre+22
Commit 5078421* (2015-04-28 09:05 UTC)
Platform Info:
  System: Linux (x86_64-amazon-linux)
  CPU: Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libmkl_rt
  LAPACK: libmkl_rt
  LIBM: libimf
  LLVM: libLLVM-3.3

"pre" stairs plot

It's useful to have different styles of stair plots. Here's a variant where the step occurs before the next point:

diff --git a/src/scatterplot.jl b/src/scatterplot.jl
index 44ed684..888cac9 100644
--- a/src/scatterplot.jl
+++ b/src/scatterplot.jl
@@ -113,6 +113,27 @@ function stairs!{T<:Canvas,F<:Real,R<:Real}(plot::Plot{T}, X::Vector{F}, Y::Vect
   lineplot!(plot, xVec, yVec; args...)
 end

+function stairs_pre!{T<:Canvas,F<:Real,R<:Real}(plot::Plot{T}, X::Vector{F}, Y::Vector{R}; args...)
+  xVec = zeros(length(X) * 2 - 1)
+  yVec = zeros(length(X) * 2 - 1)
+  xVec[1] = X[1]
+  yVec[1] = Y[1]
+  o = 0
+  for i = 2:(length(X))
+    xVec[i + o] = X[i-1]
+    xVec[i + o + 1] = X[i]
+    yVec[i + o] = Y[i]
+    yVec[i + o + 1] = Y[i]
+    o += 1
+  end
+  lineplot!(plot, xVec, yVec; args...)
+end
+
+
 function stairs{F<:Real,R<:Real}(X::Vector{F},Y::Vector{R}; args...)
   xVec = zeros(length(X) * 2 - 1)
   yVec = zeros(length(X) * 2 - 1)

tty_size is deprecated

julia> spy(eye(3))
WARNING: tty_size is deprecated. use `displaysize(io)` as a replacement
 in depwarn(::String, ::Symbol) at ./deprecated.jl:64
 in tty_size() at ./deprecated.jl:182
 in #spy#62(::Int64, ::Int64, ::String, ::Int64, ::Int64, ::Int64, ::Int64, ::Symbol, ::Bool, ::Type{UnicodePlots.BrailleCanvas}, ::Array{Any,1}, ::UnicodePlots.#spy, ::Array{Float64,2}) at /home/ubuntu/.julia/v0.5/UnicodePlots/src/interface/spy.jl:116
 in spy(::Array{Float64,2}) at /home/ubuntu/.julia/v0.5/UnicodePlots/src/interface/spy.jl:103
 in eval(::Module, ::Any) at ./boot.jl:234
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
 in macro expansion at ./REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68
while loading no file, in expression starting on line 0
julia --version
julia version 0.5.0

Support Colors.Colorant

Would be nice if you could set any color using RGB from Colors.jl (or just accepting a tuple of (R,G,B)?)

Get more useful as a Plots backend

@tbreloff Since I have to spend some time on UnicodePlots again soon to make it 0.5 ready anyway, I am considering what other task I should tackle while I am at it (aside from some open bugs). Do you have a list of suggestions that would be useful for Plots? For example, you mentioned the support for ColorTypes before, which is something that I am considering doing (I had to spend quite some time with those recently for a different project, so I am already a little familiar with the basic gist).

Anything else that comes to mind? Everyone is welcome to chime in and propose things they would really like to see in UnicodePlots

Boxplots

Since my main use-case for Julia right now is simulation/optimization and I still do my data analysis in R, I don't really need a boxplot in Julia.

That being said, I am very intrigued to implement one simply because there are perfect Unicode signs available to do this (they wouldn't even have a gap between the lines like they do here)

──┬──
  │
┌─┴─┐
│   │
├───┤
│   │
└─┬─┘
  │
──┴──

The only issue I guess would be scale. Alternatively one could use simply the BrailleCanvas and draw lines, which would offer a better resolution.

Does anyone have an opinion on boxplots?

InexactError() when plotting

When trying to plot Array{Float64, N}, sometimes I get the following error:

ERROR: InexactError()
 in Plot at /home/USER/.julia/v0.4/UnicodePlots/src/plot.jl:151

There are no NaN or Inf values

ylim exaggerated

Not sure if this is the same as #21 but setting ylim=[0, 1.1] actually ends up using [0, 2], which seems a bit overboard:

julia> using UnicodePlots
julia> lineplot(collect(1:100), rand(100), ylim=[0, 1.1])
     ┌────────────────────────────────────────┐
   2 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
     │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⢠⠀⠀⠀⢠⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
     │⢠⡄⠀⢀⠀⠀⡄⠀⠀⠀⡀⠀⠀⠀⢸⠀⡇⣿⣧⠀⠀⢸⣧⠀⠀⠀⠀⣷⠀⢠⠀⠀⢰⠀⠀⡆⠀⠀⢠⠀│
     │⢸⢇⢰⣼⡇⣾⣇⢀⠀⢸⡇⠀⠀⠀⢸⡀⣷⣿⣿⠀⠀⢸⣿⡄⠀⠀⢀⢿⢀⣼⣇⢀⣼⠀⡆⣧⡆⢰⣾⠀│
     │⢸⠘⡾⣿⣷⣿⣿⣸⠀⢸⡇⡆⠀⡀⢸⡇⣿⣿⣿⢰⡇⢸⠇⡇⠀⢀⣼⢸⢸⣿⣿⢸⡏⡆⣿⣿⢣⡸⣿⠀│
     │⡜⠀⠁⢿⣿⢿⣿⡏⡆⢸⡇⣷⣷⣧⣼⣷⢻⢿⣿⢸⢇⢸⠀⡇⡄⢸⣿⢸⡎⠏⢻⢸⠀⣿⠸⣿⢸⡇⡿⣦│
     │⠃⠀⠀⢸⣿⢸⣿⡇⡇⢸⣧⢻⠁⠘⡟⢿⢸⠸⠇⣿⢸⣿⠀⢣⣿⡎⡿⢸⡇⠀⠸⡇⠀⣿⠀⢸⢸⡇⡇⡇│
     │⠀⠀⠀⢸⣿⠸⡇⠁⡇⢸⣿⠈⠀⠀⡇⠈⢸⠀⠀⣿⠀⣿⠀⢸⡏⠃⠁⠸⡇⠀⠀⡇⠀⠹⠀⠈⢸⠇⠀⡇│
   0 │⠀⠀⠀⠘⠇⠀⠀⠀⠉⠋⠸⠀⠀⠀⠀⠀⠀⠀⠀⢿⠀⢹⠀⠘⠃⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀│
     └────────────────────────────────────────┘
     0                                      100

Testing other values of ylim it seems the upper bound is rounded up to the next integer. Is that the case?

plot in external window

It would be cool to send the plots to some other terminal window. This would be useful for some plot that constantly gets updated by some process. This way we can have some basic UI in the current terminal while the resulting plot (that additionally depends on some other continuously updating process) gets updated in the other.

UnicodePlots with Emacs ESS

First of all thanks for a great library. I have been trying to get the library to work inside Emacs. Unfortunately the graphs are not legible with the exception of bar plot. Any suggestion if it would be possible to make the library work inside of Emacs.

unicode_plot

UTF8 Warnings in julia 0.5

julia> using UnicodePlots

julia> lineplot(rand(10))
WARNING: Base.UTF8String is deprecated, use String instead.
  likely near no file:0
WARNING: Base.UTF8String is deprecated, use String instead.
  likely near no file:0
WARNING: Base.UTF8String is deprecated, use String instead.
  likely near no file:0
WARNING: Base.UTF8String is deprecated, use String instead.
  likely near no file:0
WARNING: Base.UTF8String is deprecated, use String instead.
  likely near no file:0
WARNING: Base.UTF8String is deprecated, use String instead.
  likely near no file:0
WARNING: Base.UTF8String is deprecated, use String instead.
  likely near no file:0
...

Improve documentation

I have sketched out a basic draft for the docstring documentation, but it could really use some love.

I am not very good in this sort of thing, so this kind of contribution would be very welcomed.

Default canvas shows question marks only (windows)

I guess this is because windows cmd cannot display unicode characters (can it?), but just to let you know, the default canvas looks "questionable" ;)

unicodeplots_on_windows

is there any terminal that works with UnicodePlots on windows?

Feature requests

Thanks for a great plotting package. Thousands of times faster than anything else out there for Julia!

Here are a few feature requests:

  1. add stair plots one by one (stairs!())
  2. a spy() function to plot sparsity patterns
  3. add axis labels in addition to "ticks"
  4. add :bc (bottom center) location (and perhaps :tc (top center))
  5. colored annotations (e.g., for colored legends)

Here's the first feature:

function lineplot!{T <: Canvas, F <: Real, R <: Real}(plot :: Plot{T}, X :: Vector{F}, Y :: Vector{R}; color::     Symbol=:white, args...)
  X = convert(Vector{FloatingPoint},X)
  Y = convert(Vector{FloatingPoint},Y)
  drawLine!(plot, X, Y, color)
end

function stairs!{T <: Canvas, F <: Real, R <: Real}(plot :: Plot{T}, X :: Vector{F} , Y :: Vector{R}; args...)
  xVec = zeros(length(X) * 2- 1)
  yVec = zeros(length(X) * 2 - 1)
  xVec[1] = X[1]
  yVec[1] = Y[1]
  o = 0 
  for i = 2:(length(X))
    xVec[i + o] = X[i]
    xVec[i + o + 1] = X[i]
    yVec[i + o] = Y[i-1]
    yVec[i + o + 1] = Y[i]
    o += 1
  end 
  lineplot!(plot, xVec, yVec; args...)
end

And here's a primitive spy():

function spy(A :: SparseMatrixCSC, args...)
  rows, cols, vals = findnz(A)
  nrow, ncol = size(A)
  canvas = BrailleCanvas(40, int(20 * nrow / ncol),
                         plotWidth=float(ncol)+1, plotHeight=float(nrow)+1)
  spyplot = Plot(canvas, args...)
  setPoint!(spyplot,
            convert(Vector{FloatingPoint}, cols),
            nrow + 1 - convert(Vector{FloatingPoint}, rows),
            :green)                                                                                                
  return spyplot
end

screen shot 2015-08-18 at 10 20 41

Automatic sparsity pattern aspect ration

When using spy the size of the plot currently defaults do a 1:1 aspect ratio, which isn't generally the best choice. I should change the size to depend on the matrix size (within some reasonable bounds) to reflect the structure of the matrix

ERROR: LoadError: LoadError: syntax: invalid type signature

Hi

I have received this error when Julia> using UnicodePlots.jl

It follows

julia> using UnicodePlots
INFO: Precompiling module UnicodePlots.
ERROR: LoadError: LoadError: syntax: invalid type signature
 in include_from_node1(::String) at ./loading.jl:488
 in include_from_node1(::String) at /Applications/JuliaPro-0.5.0.4.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?
 in include_from_node1(::String) at ./loading.jl:488
 in include_from_node1(::String) at /Applications/JuliaPro-0.5.0.4.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?
 in macro expansion; at ./none:2 [inlined]
 in anonymous at ./<missing>:?
 in eval(::Module, ::Any) at ./boot.jl:234
 in eval(::Module, ::Any) at /Applications/JuliaPro-0.5.0.4.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?
 in process_options(::Base.JLOptions) at ./client.jl:239
 in _start() at ./client.jl:318
 in _start() at /Applications/JuliaPro-0.5.0.4.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?
while loading /Applications/JuliaPro-0.5.0.4.app/Contents/Resources/pkgs-0.5.0.4/v0.5/UnicodePlots/src/canvas.jl, in expression starting on line 1
while loading /Applications/JuliaPro-0.5.0.4.app/Contents/Resources/pkgs-0.5.0.4/v0.5/UnicodePlots/src/UnicodePlots.jl, in expression starting on line 51
ERROR: Failed to precompile UnicodePlots to /Applications/JuliaPro-0.5.0.4.app/Contents/Resources/pkgs-0.5.0.4/lib/v0.5/UnicodePlots.ji.
 in compilecache(::String) at ./loading.jl:593
 in require(::Symbol) at ./loading.jl:422
 in require(::Symbol) at /Applications/JuliaPro-0.5.0.4.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?

Support for DejaVu Sans?

Hi,

First of all, thanks for the great package; I'm really enjoying it.

I'm having some trouble getting correct behavior with the popular font DevaVu Sans Mono (under LXTerminal, XTerm, and Gnome terminal). It does work correctly, under, eg, Droid Sans Mono, as well as several other fonts. The problem is that the background dots all appear white, instead of the (black) background color. Any ideas?

I attached an image under LXTerminal
unicodeplots

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.