Specifying edges and missing values for barplots

Source code Author Update time

using Plots
unicodeplots()

In bar(x, y), x may be the same length as y to specify bar centers, or one longer to specify bar edges.

plot(bar(-5:5, randn(10)), bar(-2:2, [2, -2, NaN, -1, 1], color = 1:5), legend = false)
┌────────────────────────────────────────┐ ┌────────────────────────────────────────┐ 0.90514 │⠀⠀⠀⠀⠀⢸⠉⚬⢹⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│  2 │⠀⠀⡏⠉⠉⚬⠉⠉⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│   │⠀⠀⠀⠀⠀⢸⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│   │⠀⠀⡇⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│   │⠀⠀⡏⚬⠉⣿⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│   │⠀⠀⡇⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│   │⠀⠀⡇⠀⠀⣿⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│   │⠀⠀⡇⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⚬⣀⣀⣀⠀⠀│   │⣀⣀⣇⣀⣀⣿⣀⣀⣸⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣇⣀⣀⣰⣒⚬⣲⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀│   │⠀⠀⡇⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⢸⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⡇⡇⠀⠀⣿⠀⠀⢸⡇⠀⠀⡇⠀⠀⠀⠘⠒⚬⠚⡇⠀⠀⣿⠀⠀⢸⠀⠀│   │⠀⠀⡇⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⢸⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⡇⡇⠀⠀⣿⠀⠀⢸⡇⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⣿⠀⠀⢸⠀⠀│   │⠀⠀⡇⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⢸⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⡇⡇⠀⠀⣿⠀⠀⢸⡇⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⣿⠀⠀⢸⠀⠀│   │⠤⠤⠧⠤⠤⠤⠤⠤⠧⢤⠤⠤⠤⠤⠤⢤⠤⠤⠤⠤⡧⠤⠤⠤⡤⠤⠤⠤⠤⠤⡤⠼⠤⠤⠤⠤⠤⠼⠤⠤│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⡇⡇⠀⠀⡟⠒⚬⠚⡗⚬⠒⠃⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⣿⠀⠀⢸⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⡇⠀⠀⠀⡇⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⡇⡇⠀⠀⡇⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⣿⠀⠀⢸⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⡇⠀⠀⠀⡇⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⡇⡇⠀⠀⡇⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⣿⠀⠀⢸⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⡇⠀⠀⠀⡇⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⡇⠧⚬⠤⠇⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⣿⠀⠀⢸⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⡇⠀⠀⠀⠓⠒⠒⚬⠒⠒⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠧⚬⠤⢿⠀⠀⢸⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⣇⚬⣀⡇⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⢸⠀⠀│   │⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│  -1.90761 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣀⚬⣸⠀⠀│  -2 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣀⣀⚬⣀⣀⣸⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│  └────────────────────────────────────────┘ └────────────────────────────────────────┘ ⠀-5.50564⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀5.50564⠀ ⠀-2.69664⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀2.69664⠀

This page was generated using DemoCards.jl and Literate.jl.