Skip to content

anselmrothe/ggplot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plotting your data with ggplot in R

Getting started

Install R (about 1 minute): download here

Install RStudio (about 1 minute): download here

Install ggplot (about 1.5 minutes):

  • open RStudio
  • type into the console in RStudio: install.packages('tidyverse') and hit enter
  • If it asks "Do you want to install from sources the packages which need compilation?" type no and hit enter

Examples

1 Most simple example

library(tidyverse)
x <- c(1, 2, 5, 1, 7, 3, 2, 4, 5, 7, 0, 3, 1)
y <- c(0, 4, 7, 4, 8, 2, 6, 3, 5, 4, 2, 7, 1)
df <- tibble(x, y) # ggplot needs data in data frame format
ggplot(df, aes(x, y)) + geom_point() # scatterplot

2 Commute data set example

See here. We will go through this example step by step. It's going to be fun!

3 Full cycle example

This example doesn't exist yet -- Getting the data into the right shape for plotting is a skill on its own, so this could become the content of for a future workshop.

Full cycle:

  1. Load data
  2. Reshape data
  3. Plot data

Resources

(Subjective selection)

If I get stuck with a ggplot problem, I often just use google (for example "ggplot change order of colors"). Usually very efficient; leads you often to helpful answers on stackoverflow (example).

ggplot cheat sheet

introduction to ggplot by the master himself

another comprehensive introduction (1)

another comprehensive introduction (2)

examples with code (1)

examples with code (2)

ggplot main page

bad plots

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages