Discrete scale constructor.


discrete_scale(aesthetics, scale_name, palette, name = NULL, breaks = waiver(), labels = waiver(),
  legend = NULL, limits = NULL, expand = waiver(), na.value = NA, drop = TRUE,
      guide = "legend")


the names of the aesthetics that this scale works with
the name of the scale
a palette function that when called with a single integer argument (the number of levels in the scale) returns the values that they should take
the name of the scale - used as the axis label or the legend title
drop unused factor levels from the scale (TRUE or FALSE)
control the breaks in the guide. There are four possible types of input:
  • NULL: don't display any breaks
  • a character vector giving the breaks as they should appear on the axis or in the legend.
  • waiver() to use the default break computation.
  • a function, that when called with a single argument, a character vector giving the limits of the scale, returns a character vector specifying which breaks to display.
This parameter does not affect in any way how the data is scaled - it only affects the appearance of the legend.
A character vector specifying the data range for the scale. and the default order of their display in guides.
NULL for no labels, waiver() for default labels (labels the same as breaks), a character vector the same length as breaks, or a named character vector whose names are used to match replacement the labels for matching breaks.
deprecated. Use guide instead.
a numeric vector of length two, giving a multiplicative and additive constant used to expand the range of the scales so that there is a small gap between the data and the axes.
how should missing values be displayed?
the name of, or actual function, used to create the guide.


Discrete scale constructor.