ggplot2_labels

[Beginner] Graph for Communication - Label

Evan Jung 1/3/2019

1. Introduction

In EDA(Exploratory Data Analysis), many ways to build plots as tools for exploration. Most of you made each plot for some reason and purpose for clients. To let clients understand your data and graph, you need to know the way to communicate your thoughts and understandings to others.

We will review R for Data Science written by Garrett Grolemund & Hadley Wichham.

This simple article aims to R users who knows how to draw graph using tidyverse package. If you are newbie for R, then click above the link and read chapter 3 carefully.

We are on chater 28, though.

2. Label

The easiest place to start when turning an explorator graphic into an expository graphic is with good labels. You add labes with labs

(1) labs() function


What is titie? Well, in general, title is big picture of graph, summarizing the main finding. Part of facts, e.g. “A scatterplot of displ and hwy” is not the title because it has no any finding from Analyst.

(2) Subtitle & Caption

If you want to add more text, giving more information to clients, then you may think of subtitle & caption.


Look!

  • Subtitle adds additional detail in a smaller font beneath the title
  • caption adds text at the bottom right of the plot, often used to describe the source of the data

(3) x and y title replacement

Look graph 1 & 2. The titles of x and y are a bit strange to read it. Yes, clients can’t understand those abbreviation, so you want to spread it to full name. On the other hand, when you code with R, you want to select variable typing letters. Then, you might be introuble to code.

labs function makes both of group easy to do the job.


(4) Formula on X and Y

This is option. If you working with math, physics, etc. You want to put formula to x-axis and y-axis. Below the way.


It looks difficult. but You can do it with R Documentation. Type on code chunk ?plotmath like below

Let me introduce some quotes

Syntax Meaning
x + y x plus y
x - y x minus y
sqrt(x) square root of x


+ Recent posts