Reputation: 95
I am trying to plot a curve with the following command but I need to limit the y-axis until 100, so can anybody help me find out how to do it? Thanks in advance
ggplot(file1, aes(x=f11,colour=time, alpha=time, size=time))+
geom_line(aes(y = S1))+scale_color_manual(values =c("t1"="red","t2"="magenta","t3"="coral4","t5"=cl[8]),
labels=labels1 ,name="Time")+
scale_alpha_manual(values=c(1, 1, 1, 1),labels=labels1)+
scale_size_manual(values = c(.6, .61, .61, .61),labels=labels1)+
guides(colour = guide_legend(title=title),
alpha = guide_legend(title=title),
size = guide_legend(title=title))+
labs(title="Column 1")+ theme_bw()+theme(plot.title=element_text(size=12,hjust=0.5,face="bold"))+
theme(aspect.ratio = 1)+ theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())+
xlab( growth)+ylab(nutrient )+
scale_x_continuous(breaks = seq(0, 0.5, by=0.10), limits=c(0,0.5))+
scale_y_continuous(trans='log10')
Upvotes: 0
Views: 43
Reputation: 41603
You can use the function scale_y_log10
and set limits
like in the following code:
library(ggplot2)
ggplot(data = df,aes(x = x, y =y)) +
geom_point() +
scale_y_log10(limits = c(1,100))
Output:
df <- data.frame(x = 1:10, y = seq(1,150,length.out = 10))
Upvotes: 2