Skip to content
/ ggmjs Public

A ggplot2 theme for the Milwaukee Journal Sentinel

Notifications You must be signed in to change notification settings

datahub/ggmjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ggmjs

A ggplot2 theme for the Milwaukee Journal Sentinel

What's it look like?

Before

Image of base bar chart

After

Image of mjs bar chart

See the examples/ folder for example graphics generated using the theme.

How do I use it?

Add + theme_mjs() to a ggplot2 chain of commands.

For example:

ggplot(mpg, aes(x = cty, y = hwy)) +
  geom_point() +
  ggtitle('Title', 'Subtitle') +
  theme_mjs()

Install

Install prequisites within the R console.

install.packages('devtools')
install.packages('roxygen2')
library(devtools)
library(roxygen2)

From the terminal, pull down this repo from github.

git pull https://github.com/datahub/ggmjs.git

Install ggmjs in the R console.

setwd('[parent folder to ggmjs]')
install('ggmjs')

Note:

A more streamlined way of installing this package would be to use the install_github() function from the devtools package. Because it is currently a private repo you would enter install_github('datahub/ggmjs', auth_token = PAT) in the R console, where PAT is a personal access token generated here: https://github.com/settings/tokens. If this repo were made public then install_github('datahub/ggmjs') alone would work.

Develop

Follow the instructions from the Install section.

Make changes to the code in the R/ folder. Add documentation to each exported function following roxygen2 conventions.

When you're done, compile the documentation. Run this in the R console.

setwd('./ggmjs')
document()

Reinstall the package following the instructions in the Install section and you'll be able to test the library.

See Hilary Parker's blog post on writing R packages for a bit more context.

Tips on editing ggplot themes: http://ggplot2.tidyverse.org/reference/theme.html

About

A ggplot2 theme for the Milwaukee Journal Sentinel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages