File: labs.Rd

package info (click to toggle)
r-cran-ggplot2 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,412 kB
  • sloc: sh: 9; makefile: 1
file content (45 lines) | stat: -rw-r--r-- 999 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
% Generated by roxygen2 (4.0.1): do not edit by hand
\name{labs}
\alias{ggtitle}
\alias{labs}
\alias{xlab}
\alias{ylab}
\title{Change axis labels and legend titles}
\usage{
labs(...)

xlab(label)

ylab(label)

ggtitle(label)
}
\arguments{
\item{label}{The text for the axis or plot title.}

\item{...}{a list of new names in the form aesthetic = "new name"}
}
\description{
Change axis labels and legend titles
}
\examples{
p <- qplot(mpg, wt, data = mtcars)
p + labs(title = "New plot title")
p + labs(x = "New x label")
p + xlab("New x label")
p + ylab("New y label")
p + ggtitle("New plot title")

# This should work indepdendently of other functions that modify the
# the scale names
p + ylab("New y label") + ylim(2, 4)
p + ylim(2, 4) + ylab("New y label")

# The labs function also modifies legend labels
p <- qplot(mpg, wt, data = mtcars, colour = cyl)
p + labs(colour = "Cylinders")

# Can also pass in a list, if that is more convenient
p + labs(list(title = "Title", x = "X", y = "Y"))
}