Reversed discrete scale for 'ggplot2'
Source:R/scale_discrete_reverse.R
scale_y_discrete_reverse.Rd
scale_y_discrete_reverse()
and scale_x_discrete_reverse()
are standard discrete 'ggplot2'
scales with a reversed order of values. Since the ggplot2 coordinate system starts with 0 in
the lower left corner, factors on the y-axis are sorted is descending order by default
(i.e. alphabetically from Z to A). With this scale the the y-axis will start with the
first factor level at the top or with alphabetically correctly ordered values
Arguments
- name
The name of the scale. Used as the axis or legend title. If
waiver()
, the default, the name of the scale is taken from the first mapping used for that aesthetic. IfNULL
, the legend title will be omitted.- limits
Can be either NULL which uses the default reversed scale values or a character vector which will be reversed.
- ...
Arguments passed on to
ggplot2::discrete_scale()
- expand
For position scales, a vector of range expansion constants used to add some padding around the data to ensure that they are placed some distance away from the axes. Use the convenience function
expansion()
to generate the values for theexpand
argument. The defaults are to expand the scale by 5% on each side for continuous variables, and by 0.6 units on each side for discrete variables.- position
For position scales, The position of the axis.
left
orright
for y axes,top
orbottom
for x axes.