• Stars
    star
    265
  • Rank 148,895 (Top 4 %)
  • Language
    HTML
  • Created over 6 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ggplot2 shortcuts (transformations made easy)

ggeasy

Covrpage Summary Travis build status AppVeyor build status R-CMD-check Codecov test coverage CRAN status

You know how to make ggplot2 graphics, right? No worries. Piece of cake.

Now, can you please rotate the x axis labels to vertical?

ggeasy is here to make that a little easier.

Installation

You can install the latest released version of ggeasy from CRAN with:

install.packages("ggeasy")

or the bleeding-edge development version from GitHub with

# install.packages("remotes")
remotes::install_github("jonocarroll/ggeasy")

Reference

See the pkgdown site.

@amrrs a.k.a. @1littlecoder has produced a video walkthrough using ggeasy which covers some of the major features:

Watch the video

Sharon Machlis has a great article detailing using the package, as well as a video

Watch the video

Examples

library(ggplot2)
library(ggeasy)

# rotate x axis labels
ggplot(mtcars, aes(hp, mpg)) + 
    geom_point() + 
    easy_rotate_x_labels()

# rotate y axis labels
ggplot(mtcars, aes(hp, mpg)) + 
    geom_point() + 
    easy_rotate_y_labels()

# remove 'size' legend
ggplot(mtcars, aes(wt, mpg, colour = cyl, size = hp)) +
    geom_point() +
    easy_remove_legend(size)

# make the x axis labels larger
ggplot(mtcars, aes(mpg, hp)) +
  geom_point() +
  easy_x_axis_labels_size(22)

# make all the text red
ggplot(mtcars, aes(mpg, hp)) +
  geom_point(aes(fill = gear)) +
  easy_all_text_color("red")

# remove just x axis
ggplot(mtcars, aes(wt, mpg)) +
  geom_point() + 
  easy_remove_x_axis()

# remove y axis ticks
ggplot(mtcars, aes(wt, mpg)) +
  geom_point() + 
  easy_remove_y_axis(what = "ticks")

# move legends to bottom
ggplot(mtcars, aes(wt, mpg, colour = cyl, size = hp)) +
  geom_point() + 
  easy_move_legend("bottom")

# move legend to left side
ggplot(mtcars, aes(wt, mpg, colour = cyl, size = hp)) +
  geom_point() +
  easy_legend_at("left")

# Make legends horizontal
ggplot(mtcars, aes(wt, mpg, colour = cyl, size = hp)) +
  geom_point() + easy_rotate_legend("horizontal")

# use labelled variables
iris_labs <- iris
labelled::var_label(iris_labs$Species) <- "Flower\nSpecies"
labelled::var_label(iris_labs$Sepal.Length) <- "Length of Sepal"
iris_labs_2 <- iris_labs
labelled::var_label(iris_labs_2$Species) <- "Sub-genera"

# use variable labels automatically
ggplot(iris_labs, aes(x = Sepal.Length, y = Sepal.Width)) +
    geom_line(aes(colour = Species)) + 
    geom_point(data = iris_labs_2, aes(fill = Species), shape = 24) +
    easy_labs()

These functions will try to teach you the ‘official’ way to achieve these goal, usually via the teach argument (where implemented)

ggplot(mtcars, aes(hp, mpg)) + 
    geom_point() + 
    easy_rotate_y_labels(angle = "startatbottom", teach = TRUE)
#> easy_rotate_y_labels call can be substituted with:
#> theme(axis.text.y = element_text(angle = 90, hjust = 0))

ggplot(mtcars, aes(wt, mpg)) +
  geom_point() + 
  easy_remove_y_axis(what = "ticks", teach = TRUE)
#> easy_remove_y_axis call can be substituted with:
#> theme(axis.ticks.y = element_blank())

Credits

Many thanks to Sébastien Rochette (@statnmap) for the design and execution of the hex logo.

More Repositories

1

mathpix

Query the mathpix API to convert math images to LaTeX
R
244
star
2

ggshape

Arrange 'ggplot' facets in arbitrary shapes
R
79
star
3

ggghost

👻 Capture the spirit of your ggplot call
R
49
star
4

purrr2for

Automagically Convert purrr R Calls to Efficient Julia for Loops
R
49
star
5

ntfy

Lightweight Wrapper to the ntfy.sh Service
JavaScript
41
star
6

regexmagic

Automated Detection of Regular Expression Patterns
R
37
star
7

githubtools

Tools to complement building and using R packages installed from GitHub
R
24
star
8

dash

RStudio Addin to Run a Selection as a Background Job
R
22
star
9

importAs

Idiomatic Python Shorthand Imports
R
20
star
10

DFplyr

A `DataFrame` (`S4Vectors`) backend for `dplyr`
R
15
star
11

realtime

R
15
star
12

butteRfly

Build a social network dashboard in R (Twitter/Facebook/GitHub/etc...)
R
14
star
13

TriangulArt.jl

Artify images using Delaunay Triangulation
Julia
13
star
14

starryeyes

"Oh my God! — it's full of stars!"
R
12
star
15

tidyGDPR

General Data Protection Regulation as Tidy Object(s)
R
11
star
16

VolunteerVignettes

The world needs more #rstats vignettes, so I'll be the change I want to see
R
9
star
17

runkeepR

Extract, plot, and analyse Runkeeper(TM) data.
R
9
star
18

opr

🔐 Interact with the 1Password CLI tool 'op'
R
7
star
19

btts

We need to go... Back To The Source
R
6
star
20

22degrees

Attempts to investigate moon halo star counts vs rain events in R
R
5
star
21

rx86

Simulated x86 assembly processing
R
4
star
22

jcarroll.com.au

HTML
4
star
23

chaint

"chain with a tee" -- add tee functions to magrittr/dplyr chains
R
4
star
24

advent-of-code

My Advent of Code Solutions in R and Rust
R
3
star
25

bluey

Episode scripts for the TV show Bluey scraped from the fandom site
Python
3
star
26

AUelection2016

Analysis of the 2016 Australian Federal Election with flexdashboard
HTML
3
star
27

itdepends

Is It Sufficient To Use Imports?
R
2
star
28

rps.rs

Rock, Paper, Scissors game, demonstrating enums
Rust
1
star
29

RDataGovAU

Access data.gov.au open data sets with R
R
1
star
30

SAHansard

Wraps the SA Parliament Hansard API
CSS
1
star
31

jonocarroll

Jonathan Carroll
1
star
32

FEN.rs

[toy project] FEN chess notation parser in Rust
Rust
1
star
33

useR2022

CSS
1
star
34

chessclub

R
1
star
35

weasel

Provides `pop()` and `push()` functionality
R
1
star