Skip to content

Instantly share code, notes, and snippets.

@cdesante
Created November 14, 2012 05:52
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdesante/4070548 to your computer and use it in GitHub Desktop.
Save cdesante/4070548 to your computer and use it in GitHub Desktop.
hjustvjust
hjustvjust <- expand.grid(
hjust=c(0, 0.5, 1),
vjust=c(0, 0.5, 1),
angle=c(0, 45, 90),
text="is-R"
)
hv <- ggplot(hjustvjust, aes(x=hjust, y=vjust)) +
geom_point() +
geom_text(aes(label=text, angle=angle, hjust=hjust, vjust=vjust)) +
facet_grid(~angle) +
scale_x_continuous(breaks=c(0, 0.5, 1), expand=c(0, 0.2)) +
scale_y_continuous(breaks=c(0, 0.5, 1), expand=c(0, 0.2)) + theme_bw()
hv + labs(title="Various values of angle, hjust and vjust in ggplot \n", y ="vjust \n", x =" \n hjust") +
theme(axis.text.x = element_text(colour="black",
size = 12,
face = "bold") ,
axis.text.y = element_text(colour="black",
size = 12,
face = "bold"),
axis.title.x = element_text(face="plain",
colour="black",
size=24),
axis.title.y = element_text(face="plain",
colour="black",
size=24),
plot.title = element_text(face="bold",
colour="black",
size=18))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment