Question

My question is certainly a replicate but I can't find the answer.

On the x-axis the values that have a tick in my plot are: 2.5,5,7.5,10,12.5. I want to modify which values have a tick in order to see the following values: 2,4,6,8,10,12

In order to make sure I was well understood: I do not want to change my axes to something that is not carthesian, I just want to change which positions on the x axis are annotated.

How can I achieve this?

Here is my current code:

ggplot(data.and.factors.prov,aes(x=number.of.traits,y=FP,colour=factor(Corr))) +  
    stat_summary(fun.data=mean_cl_normal,position=position_dodge(width=0.2)) + 
    geom_blank() + 
    geom_smooth(method='lm',se=F,formula=y~I(x))  + 
    labs(x='Number of traits') + 
    scale_colour_manual(values=c(1:6),name='Correlation Coefficient') + 
    xlim(c(1,12))
Was it helpful?

Solution

Use scale_x_discrete(breaks = seq(2, 12, by=2))

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top