Git Product home page Git Product logo

ggpub's Introduction

Summary

Introducing a ggplot2 theme to make it easier to produce figures that meet the format requirements of academic journals.

Summary

Install the development version of ggpub using devtools:

library(devtools)
install_github("robertwilson190/ggpub")

Basic usage

The theme theme_pub is designed to make creating journal-ready figures using ggplot2 relatively pain free. I will begin with data from iris data set. Here is what it looks like using ggplot2's defaults.

library(ggplot2)

ggplot(iris, aes(Sepal.Length, Sepal.Width))+
	geom_point()

This kind of plot will be rejected by most journals. For a start many hold to the outdated idea that everything needs a white background. There are some options within ggplot2. For example, here is theme_classic:

ggplot(iris, aes(Sepal.Length, Sepal.Width))+
	geom_point()+
	theme_classic()

In many cases this will provide a figure that is acceptable in a journal. But in others it will not. For example, there are journals who insist axis ticks point inwards, or insist that there should be a full border around the plot.

So, here I will introduce theme_pub, a theme that makes it easy to satisfy both publishers and your own desire for an aethetically pleasing figure.

The theme defaults to what I believe are the requirements of the most journals: a plain white background, no grid, outer axes ticks, and a rectangular border around the plot.

library(ggpub)
ggplot(iris, aes(Sepal.Length, Sepal.Width))+
	geom_point()+
	theme_pub()

If the journal requires inner axes ticks, this can easily be added using the "ticks_type" command:

library(ggpub)
ggplot(iris, aes(Sepal.Length, Sepal.Width))+
	geom_point()+
	theme_pub(ticks_type = "inner")

ggpub's People

Contributors

robertjwilson avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.