Using this code:
ggplot(data=new.data+
geom_point(mapping=aes(x=num,y=score),shape=0)+
geom_smooth(mapping=aes(x=number,y=score),color="black",method="lm")+
xlim(2,9)+
ylim(10,25)+
xlab("Number of trials")+
ylab("Mean Outcome")+
theme(panel.grid.minor = element_blank(),
panel.background = element_blank(),axis.line = element_line(colour = "black"))
We can create the following ggplot:
What I want to do is add a second x-axis, ideally at the top of the plot. There should be seven entries corresponding to each of the seven x-values. The issue is they are not in a one to one correspondence to the x. For example they should be 1,2,4,8,16,32,64 for example. With the 1 being above the first set of points, the 2 above the second, the 4 above the third, etc. Note that the number of trials is not an exact number hence it is not just integers but something like 2.5, etc.
Can this be done? I know that sec_axis requires a 1-1 transformation.
If it cannot be done through ggplot, is there a way to add it a different way?