I'm using the software R
to create the plot of some distributions. I have to see what distribution has fat tails compared to the others, then the distributions should be plotted on the same graph. The problem is in the x axes, because if I put in a plot command
axes = TRUE
and in all other axes = FALSE
, the graph will not be realistic ... just distribution in which I put axes = TRUE
will be right, the other will plotted on a wrong axis. So you can not figure out who has the fattest tail. How can I fix? In practice should make sure that all the distributions are plotted only on one x axis.
Here is my code:
pdf("DegreeI_DDF_T.pdf")
par(mar=c(4.5,5,1,1))
plot(rankI1700~degreeI_ord1700,log="xy",main="",ylab="",xlab="",type="s",col=1,axes=TRUE,lwd=1.6)
par(new=TRUE)
plot(rankI1400~degreeI_ord1400,log="xy",main="",ylab="",xlab="",type="s",col=2,axes=FALSE,lwd=1.6)
par(new=TRUE)
plot(rankI800~degreeI_ord800,log="xy",main="",ylab="",xlab="",type="s",col=3,axes=FALSE,lwd=1.6)
par(new=TRUE)
plot(rankI50~degreeI_ord50,log="xy",main="",ylab="DDF",xlab="",type="s",lwd=1.6,col=4,axes=FALSE)
#Add legend
add_legend <- function(...) {
opar <- par(fig=c(0, 1, 0, 1), oma=c(0, 0, 0, 0),
mar=c(0, 0, 0, 0), new=TRUE)
on.exit(par(opar))
plot(0, 0, type='n', bty='n', xaxt='n', yaxt='n')
legend(...)
}
add_legend("bottomright", legend=c("t=500", "t=800", "t=1500","t=1585"), pch=20,
col=c(4,3,2,1),
horiz=TRUE, bty='n', cex=1)
dev.off()
Thanks
This code go launch first->
READ_DATAdata<-read.table("df_degree_B0.00_BC0.00_l33.33_day1")
df<-data.frame(time=data$V1,bank=data$V2,indegree_credit=data$V3,indegree_interbank=data$V6)
rm(data)
degreeI1700<-df$indegree_interbank[df$time==1700]
degreeI_ord1700<-sort(degreeI1700[degreeI1700!=0],decreasing=TRUE)
rankI1700<-c(1:length(degreeI_ord1700))
degreeI1400<-df$indegree_interbank[df$time==1400]
degreeI_ord1400<-sort(degreeI1400[degreeI1400!=0],decreasing=TRUE)
rankI1400<-c(1:length(degreeI_ord1400))
degreeI50<-df$indegree_interbank[df$time==50]
degreeI_ord50<-sort(degreeI50[degreeI50!=0],decreasing=TRUE)
rankI50<-c(1:length(degreeI_ord50))
degreeI800<-df$indegree_interbank[df$time==800]
degreeI_ord800<-sort(degreeI800[degreeI800!=0],decreasing=TRUE)
rankI800<-c(1:length(degreeI_ord800))
In comment you can download the database.