MyNixOS website logo
Description

Command Line Interface Plotting.

The 'plotcli' package provides terminal-based plotting in R. It supports colored scatter plots, line plots, bar plots, and box plots. The package allows users to customize plot appearance, add titles, labels, ticks, and legends, and output the plot as a text-based visualization.

plotcli: Command-Line Plots for R

plotcli is an R package that brings the power of command-line plotting to your R environment. With a simple and intuitive R6 class interface, plotcli allows you to create and customize a variety of plot types, such as scatter, line, bar, and box plots, directly in your console.

Features

  • Convert ggplot2 objects to colored terminal plots with ggplotcli
  • Easy-to-use R6 class interface
  • Supports scatter, line, bar, and box plots
  • Customizable plot elements: title, axis labels, ticks, and legend
  • Braille character support for high-resolution plots
  • Convenience wrappers for most frequently used functions

plotcli is heavily inspired by the excellent UnicodePlots.jl library.

> ggplotcli(ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, color = Species)) + geom_boxplot())

                    ┌────────────────────────────────────────────────────────────┐       
                4.4 │       ───────                                              │       
                    │          │                                                 │       
                    │          │                                                 │       
                    │          │                                                 │       
                    │          │                                   ───────       │       
                3.8 │      ┌───────┐                                  │          │       
                    │      │       │                                  │          │       
                    │      │───────│           ───────                │          │       
                    │      │       │              │                   │          │   setosa   
Sepal.Length    3.2 │      └───────┘              │               ┌───────┐      │   versicolor   
                    │          │                  │               │       │      │   virginica   
                    │          │              ┌───────┐           │───────│      │       
                    │       ───────           │───────│           └───────┘      │       
                    │                         │       │               │          │       
                2.6 │                         │       │               │          │       
                    │                         └───────┘               │          │       
                    │                             │                   │          │       
                    │          *                  │                ───────       │       
                    │                             │                              │       
                2.0 │                          ───────                           │       
                    └────────────────────────────────────────────────────────────┘       
                                                                                         
                            setosa           versicolor           virginica              
                                                                                         
                                             Sepal.Width                                 

Installation

You can install the plotcli package from GitHub using the devtools package:

# Install devtools if you haven't already
if (!requireNamespace("devtools", quietly = TRUE)) {
  install.packages("devtools")
}

# Install plotcli from GitHub
devtools::install_github("cheuerde/plotcli")

Usage

The easiest way to use the package if you are already familiar with ggplot2 is to configure your ggplot2 object as usual and then simply convert to a plotcli terminal plot with ggplotcli:

# Load the plotcli package
library(plotcli)

data(mtcars)
mtcars$cf = as.character(mtcars$cyl)

p = ggplot(mtcars, aes(x = mpg, y = wt, color = cf)) + geom_point()

# print to terminal
ggplotcli(p, braille = FALSE)

Check the vignettes for all possible ways of using the package.

Showcase

Similar Projects

  • txtplot: The OG in R
  • r-plot: Collection of excellent terminal plotting functions
  • UnicodePlots.jl: The gold standard for terminal graphics
  • plotext: Powerful terminal graphics in python

License

plotcli is released under the MIT License.

Metadata

Version

0.1.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows