绘制多条线

时间:2017-01-27 15:16:02

标签: r plot line

以下代码给出了一个折线图,但只显示了Th1,Th2和Th17的行。其他3个值的数字明显较低(最大值约为30)但它们仍应作为线条显示。我需要在代码中输入什么来修复它?

line graph

{
  plot(type="l", termCountTh1, col="green", xaxt = "n", xlab='date', ylab='mentions', 
   main='The amount of articles mentioning when searching CD4+')
   axis(1, at=1:5, labels=2012:2016) 
   lines(termCountTh9, col="deepskyblue4")
   lines(termCountTFH, col="deeppink3")
   lines(termCountiTreg, col="darkred")
   lines(termCountTh17, col="blue")
   lines(termCountTh2, col="purple")
}

1 个答案:

答案 0 :(得分:0)

尝试在ylim=c(ymin, ymax))中设置plot()。使用lines()添加行时,轴范围不会更新。它们指的是提供给初始图的值。

在此查看示例:http://www.statmethods.net/advgraphs/axes.html

相关问题