ggplot2将较低的值置于较高的值之上

时间:2016-09-16 23:06:06

标签: r ggplot2

我在r中的情节有一些非常奇怪的结果。我写了一个完美的Lotka-Volterra模型。我想绘制参数输入的等值线图,使它们看起来像这个例子: Isoclines of a Lotka-Volterra Model where K1/alpha>K2 and K1>K2/beta

#libraries
library(ggplot2) #uses ggplot2 for figures

#parameters
r1 = 0.5 #instantaneous growth rate for species 1
r2 = 0.5 #instantaneous growth rate for species 2
initialN1 = 5 #initial population size for species 1
initialN2 = 5 #initial population size for species 2
alpha11 = 0.009 #the effect of species 1 on species 1 (intraspecific comp)
alpha12 = 0.01 #the effect of species 1 on species 2 (interspecific comp)
alpha21 = 0.01 #the effect of species 2 on species 1 (interspecific comp)
alpha22 = 0.011 #the effect of species 2 on species 2 (intraspecific comp)
totaltime = 100 #time steps to run

#Calculate isocline Values
K1<-(1/alpha11) #carrying capacity of species 1 = 111.1111
K2<-(1/alpha22) #carrying capacity of species 2 = 90.90909
K1.alpha<-((1/alpha11)*(alpha11/alpha12)) #K1/alpha = 100
K2.beta<-((1/alpha22)*(alpha22/alpha21)) #K2/beta = 100

#bind together isocline values and give appopriate row/col names
isoclines<-data.frame(rbind(c("N1 Isocline",K1,0),c("N1  
Isocline",0,K1.alpha),c("N2 Isocline",K2.beta,0),c("Isocline N2",0,K2)))
row.names(isoclines)<-rbind("K1", "K1/alpha","K2/beta","K2")
colnames(isoclines)<-c("Isocline","N1","N2")

#plot isoclines
ggplot(isoclines, aes(x = N1, y = N2)) + geom_point()

Results from ggplot2

如果查看图形,可以看到K1 / alpha(= 100)的值低于y轴上K2(= 90.909)的值。为什么会这样?为什么较低值出现在较高值之上?

0 个答案:

没有答案