[R] Axis value as percentage
hadley wickham
h.wickham at gmail.com
Thu Oct 11 16:46:25 CEST 2007
On 10/11/07, Christoph Krammer <ck at altaica.de> wrote:
> Hello,
>
> I am using ggplot2 to display some distributions, I my data, there are
> percentages represented as 0.10, 0.13, ...
>
> I now want to do the axis show "5%", "10%", "15%", ...
Not easily - but you can use the breaks and labels arguments to
scale_y_continuous to control the exact appearance of the labels,
e.g.:
breaks <- seq(0, 1, by=0.05)
+ scale_y_continuous(breaks = breaks, labels = paste(breaks * 100, "%", sep=""))
> Is there is simple way to do this? I tried to use scale_y_prob(), but I
> didn't get through it.
The probability scale is used for scaling by inverse probability
distributions, so isn't useful here.
Hadley
--
http://had.co.nz/
More information about the R-help
mailing list