Difference between revisions of "R Plot: Basics"

From OnnoWiki
Jump to navigation Jump to search
(Created page with " library(ggplot2) theme_set(theme_minimal()) # Demo dataset head(economics) # Basic line plot ggplot(data = economics, aes(x = date, y = pop))+ geom_line(color = "#00...")
 
Line 11: Line 11:
 
  ggplot(data = ss, aes(x = date, y = pop)) +  
 
  ggplot(data = ss, aes(x = date, y = pop)) +  
 
   geom_line(color = "#FC4E07", size = 2)
 
   geom_line(color = "#FC4E07", size = 2)
 +
 +
 +
==Pranala Menarik==
 +
 +
* [[R]]

Revision as of 10:49, 28 November 2019

library(ggplot2)
theme_set(theme_minimal())
# Demo dataset
head(economics)
# Basic line plot
ggplot(data = economics, aes(x = date, y = pop))+
  geom_line(color = "#00AFBB", size = 2)
# Plot a subset of the data
ss <- subset(economics, date > as.Date("2006-1-1"))
ggplot(data = ss, aes(x = date, y = pop)) + 
  geom_line(color = "#FC4E07", size = 2)


Pranala Menarik