ggfree

ArtPoon 2019

ggfree: ggplot2-style plots with just base R graphics

ggplot2 is a popular R graphics package that is becoming synonymous with data visualization in R. The community of developers working within the ggplot2 framework have implemented some rather nice extensions as well. However, it is almost always possible for a visualization produced in ggplot2 to also be generated using the base graphics package in R. Long-time users of R who are accustomed to building plots with the latter may find the syntax of ggplot2 counter-intuitive and awkward.

The overall purpose of ggfree is to make it easier to generate plots in the style of ggplot2 and its extensions, without ever actually using any ggplot2 code.

Installation

  • ggfree requires the package ape, which you can install by running the command install.packages('ape') within R.

  • The simplest way to install ggfree is to download this package and then install it on the command line. You can use the GitHub web interface to download the latest version of this package as a ZIP archive, by clicking on the green Code button and then selecting the Download ZIP option on the contextual menu that appears. If you have the git version control program installed on your computer, then you can navigate to the desired location in your filesystem and run the command: git clone https://github.com/ArtPoon/ggfree

    In either case, navigate to the ggfree directory in your Terminal app and run the command:

    art@Wernstrom ggfree % R CMD INSTALL .
    * installing to library ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library’
    
  • You can also use the devtools package to install ggfree within R. If you already have devtools installed in your R environment, then you can simply run:

    # install.packages('devtools')  # if you haven't already installed devtools
    require(devtools)
    devtools::install_github("ArtPoon/ggfree")
    

    However, devtools is a large R package with many dependencies, so I don’t recommend this method if you haven’t already installed it.