I have a bunch of measurements over time and I want to plot them in R. Here is a sample of my data. I've got 6 measurements for each of 4 time points:
values
The scale of these data is arbitrary, and in fact I'm going to normalize it so that the average of t=0 is 1.
norm
So far so good. Using ggplot
, I plot both the individual points, as well as a line that goes through the average at each time point:
require (ggplot2) p
However, now I want to apply a logarithmic scale, and this is where my trouble starts. When I do:
q
The line does NOT go through 0 at t=0, as you would expect because log (1) == 0. Instead the line crosses the y-axis slightly below 0. Apparently, ggplot
applies the mean after log transformation, which gives a different result. I want it to take the mean before log transformation.
How can I tell ggplot
to apply the mean first? Is there a better way to create this chart?