MyNixOS website logo
Description

Pretty Base Graphics.

Drop-in replacements for standard base graphics functions. The replacements are prettier versions of the originals.

Prettified Base Graphics

R-CMD-check CRAN Lifecycle:maturing Coveragestatus Downloads

Anyone who uses R Base graphics, have a 100 and 1 tweaks that they use to make the figures more presentable. This package aims to capture the tweaks in one place.

Installation

The package is still being developed and the graphs are subject to change. The package is on CRAN and can be installed in the usual way

install.packages("prettyB")

To install the dev version, try

devtools::install_github("jumpingrivers/prettyB")

The package can then be loaded in the usual way

library("prettyB")

Usage

All plotting functions work exactly as before, with the same inputs. The difference is that the defaults have been changed. For example, compare

op = par(mfrow = c(1, 2))
plot(iris$Sepal.Length, iris$Sepal.Width)
plot_p(iris$Sepal.Length, iris$Sepal.Width)
#> 

When you first call a prettyB, it changes the underlying par() and palette(). You can reset this via

prettyB::reset_prettyB()

The core idea of prettyB is that no new arguments are introducted to the plot functions. This means, that no changes to existing code are required

plot_p(iris$Sepal.Length, iris$Sepal.Width, 
     xlab = "Length", ylab = "Width",
     main = "The Iris data set", 
     sub = "I hate this data too")
#> 

Other plots

The package also prettifies other functions

  • Histograms

    z = rt(100, 4)
    hist(z, main = "The t-distribution")
    hist_p(z, main = "The t-distribution")
    
  • barplots

    barplot(VADeaths, main = "Death Rates in Virginia")
    barplot_p(VADeaths, main = "Death Rates in Virginia")
    

Package Rationale

This package is not a replacement for ggplot2 or other R related plotting packages. Instead, it has a few simple aims

  • provide package authors a low dependency method of making their plots look pretty
  • provide academics with a way of generating nice plots, but not worry about future changes in R
  • provide a simple way for improving the look and feel of plots in teaching

Since the generated plots by prettyB use standard base graphics, with no new arguments, this makes plots future proof. As a fall-back, just remove the _p.

I picked up the general style a few years ago, but the book Fundamentals of Data Visualization has made it a bit more consist. The author also provided a free online version.

Other information

  • If you have any suggestions or find bugs, please use the github issue tracker
  • Feel free to submit pull requests

Development of this package was supported by Jumping Rivers.

Metadata

Version

0.2.2

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