1

I have a file named "file1" and the following is the plot and coding for it. The problem is that I need to show and focus on the difference of these plot but I am not sure how (and I need to change this into grayscale ... so the difference cannot be even noticed!). Any suggestion would be highly appreciated.

enter image description here

cl<-rainbow(20)
labels1 <- c("t=1","t=2","t=3","t=4","t=5", "t=6")
title<-"Time"

b1<-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","t4"=cl[8],"t5"="blue","t6"="darkolivegreen"),
                     labels=labels1 ,name="Time")+
  scale_alpha_manual(values=c(1, 1, 1, 1, 1, 1),labels=labels1)+
  scale_size_manual(values = c(.6, .61, .61, .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')

b1
Shalen
  • 95
  • 6
  • It would be easier to help you if you provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) including a snippet of your data or some fake data. – stefan Feb 24 '22 at 07:31
  • This said: To get a greyscale remove scale_color_manual and replace it with `scale_color_grey`. To zoom on a part of the plot you could set the desired range via the `xlim` and `ylim` arguments of `coord_cartesian`. See e.g. [Limit ggplot2 axes without removing data (outside limits): zoom](https://stackoverflow.com/questions/25685185/limit-ggplot2-axes-without-removing-data-outside-limits-zoom) – stefan Feb 24 '22 at 07:33

0 Answers0