The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

plotcli: Command-Line Plots for R

Colored Density Plot on Terminal
Colored Density Plot on Terminal

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

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

Colored Density Plot on Terminal Colored Density Plot on Terminal Colored Density Plot on Terminal Colored Density Plot on Terminal Colored Density Plot on Terminal

Similar Projects

License

plotcli is released under the MIT License.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.