Learn R Programming

ggridges (version 0.5.1)

scale_discrete_manual: Generic discrete manual scale

Description

Generic discrete manual scale. This scale can be used to manually set the values for any aesthetics, and it is equivalent to scale_colour_manual(), scale_fill_manual(), etc. For example, instead of writing scale_colour_manual(values = c(...)), we can write scale_discrete_manual("colour", values = c(...)).

Usage

scale_discrete_manual(aesthetics, ..., values)

Arguments

aesthetics

The aesthetics for which this scale should be used

...

Other parameters handed off to discrete_scale

values

List of values to be used as palette

See Also

See scale_point_color_hue() for specific scales for point aesthetics and scale_vline_color_hue() for specific scales for vline aesthetics.

Examples

Run this code
# NOT RUN {
library(ggplot2)

ggplot(iris, aes(x=Sepal.Length, y=Species, fill = Species)) +
  geom_density_ridges(aes(point_color = Species, point_fill = Species,
                          point_shape = Species),
                      alpha = .2, jittered_points = TRUE) +
  scale_fill_manual(values = c("#0072b2", "#D55E00", "#009e73")) +
  scale_discrete_manual("point_color", values = c("#0072b2", "#D55E00", "#009e73")) +
  scale_discrete_manual("point_fill", values = c("#0072b280", "#D55E0080", "#009e7380")) +
  scale_discrete_manual("point_shape", values = c(21, 22, 23)) +
  theme_ridges()
# }

Run the code above in your browser using DataLab