I think your request is internally inconsistent: you want units of percent but 
you want to show the average(I assume you intend "mean")?

You can subtract the mean from each value and then divide by the mean, then 
subtract 1, then multiply by 100. You inherently lose visibility to what the 
mean was, but that is the nature of percentages.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<[email protected]>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Werner <[email protected]> wrote:

>Hi,
>
>this is likely very easy to do but I don't find the right terms to
>search
>for the solution. 
>I want to show in a bar chart how much different categories deviate
>from the
>average percentage change. 
>Thus, in the following example I would like to set the zero line or
>base or
>whatever it is called to the average of the values (=0.82) and the bars
>should show the deviation from that, i.e. have the positive length of
>the
>deviation of the value from the average.
>I can do that by subtracting the average from each value but I would
>like to
>have the zero line as the average to make it more clear.
>How do you change the 'base'-line?
>
>x <- data.frame(val=c(1.5, 3, -1.4, -1, 2), lab=letters[1:5])
>ggplot(data=x, aes(x=lab, y=val)) + geom_bar(stat="identity") 
>
>Many thanks for your help!
>
>Best regards,
>Werner
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Changing-the-base-of-geom-bar-in-ggplot-tp4651407.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>[email protected] mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to