• Stars
    star
    267
  • Rank 153,621 (Top 4 %)
  • Language
    HTML
  • Created almost 7 years ago
  • Updated 10 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

ntfy

Lightweight Wrapper to the ntfy.sh Service
JavaScript
60
star
4

ggghost

๐Ÿ‘ป Capture the spirit of your ggplot call
R
49
star
5

purrr2for

Automagically Convert purrr R Calls to Efficient Julia for Loops
R
49
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

DFplyr

A `DataFrame` (`S4Vectors`) backend for `dplyr`
R
20
star
10

importAs

Idiomatic Python Shorthand Imports
R
20
star
11

charcuterie

Handle Strings as Vectors of Characters
R
19
star
12

realtime

R
15
star
13

TriangulArt.jl

Artify images using Delaunay Triangulation
Julia
15
star
14

butteRfly

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

starryeyes

"Oh my God! โ€” it's full of stars!"
R
12
star
16

tidyGDPR

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

VolunteerVignettes

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

runkeepR

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

opr

๐Ÿ” Interact with the 1Password CLI tool 'op'
R
7
star
20

btts

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

22degrees

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

jcarroll.com.au

HTML
5
star
23

rx86

Simulated x86 assembly processing
R
4
star
24

chaint

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

advent-of-code

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

bluey

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

AUelection2016

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

itdepends

Is It Sufficient To Use Imports?
R
2
star
29

rps.rs

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

RDataGovAU

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

jonocarroll

Jonathan Carroll
1
star
32

SAHansard

Wraps the SA Parliament Hansard API
CSS
1
star
33

FEN.rs

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

useR2022

CSS
1
star
35

chessclub

R
1
star
36

weasel

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