File: scale_alpha.Rd

package info (click to toggle)
r-cran-ggplot2 3.5.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 9,944 kB
  • sloc: sh: 15; makefile: 5
file content (73 lines) | stat: -rw-r--r-- 2,504 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scale-alpha.R
\name{scale_alpha}
\alias{scale_alpha}
\alias{scale_alpha_continuous}
\alias{scale_alpha_binned}
\alias{scale_alpha_discrete}
\alias{scale_alpha_ordinal}
\alias{scale_alpha_datetime}
\alias{scale_alpha_date}
\title{Alpha transparency scales}
\usage{
scale_alpha(name = waiver(), ..., range = c(0.1, 1))

scale_alpha_continuous(name = waiver(), ..., range = c(0.1, 1))

scale_alpha_binned(name = waiver(), ..., range = c(0.1, 1))

scale_alpha_discrete(...)

scale_alpha_ordinal(name = waiver(), ..., range = c(0.1, 1))
}
\arguments{
\item{name}{The name of the scale. Used as the axis or legend title. If
\code{waiver()}, the default, the name of the scale is taken from the first
mapping used for that aesthetic. If \code{NULL}, the legend title will be
omitted.}

\item{...}{Other arguments passed on to \code{\link[=continuous_scale]{continuous_scale()}}, \code{\link[=binned_scale]{binned_scale()}},
or \code{\link[=discrete_scale]{discrete_scale()}} as appropriate, to control name, limits,
breaks, labels and so forth.}

\item{range}{Output range of alpha values. Must lie between 0 and 1.}
}
\description{
Alpha-transparency scales are not tremendously useful, but can be a
convenient way to visually down-weight less important observations.
\code{scale_alpha()} is an alias for \code{scale_alpha_continuous()} since
that is the most common use of alpha, and it saves a bit of typing.
}
\examples{
p <- ggplot(mpg, aes(displ, hwy)) +
  geom_point(aes(alpha = year))

# The default range of 0.1-1.0 leaves all data visible
p

# Include 0 in the range to make data invisible
p + scale_alpha(range = c(0, 1))

# Changing the title
p + scale_alpha("cylinders")
}
\seealso{
The documentation on \link[=aes_colour_fill_alpha]{colour aesthetics}.

Other alpha scales: \code{\link[=scale_alpha_manual]{scale_alpha_manual()}}, \code{\link[=scale_alpha_identity]{scale_alpha_identity()}}.

The \href{https://ggplot2-book.org/scales-colour#sec-scales-alpha}{alpha scales section} of the online ggplot2 book.

Other colour scales: 
\code{\link{scale_colour_brewer}()},
\code{\link{scale_colour_continuous}()},
\code{\link{scale_colour_gradient}()},
\code{\link{scale_colour_grey}()},
\code{\link{scale_colour_hue}()},
\code{\link{scale_colour_identity}()},
\code{\link{scale_colour_manual}()},
\code{\link{scale_colour_steps}()},
\code{\link{scale_colour_viridis_d}()}
}
\concept{alpha scales}
\concept{colour scales}