R/plot_SNA_IN.R

Defines functions plot_SNA_IN

Documented in plot_SNA_IN

plot_SNA_IN<- function(df, type){
  df <- as.data.frame(df)
  if ( type ==1){
    type= "Manufacturer"}
  else if (type == 2){
    type = "Distribution centers" 
  }
  else if ( type == 3){
    type= "Retailers"}
  
  else  if (type == 4){
    type = "Remanufacturer" 
  }
  else  {
    print("type is not correct")
  }
  layout(mat = matrix(c(2, 1, 0, 3), 
                      nrow = 2, 
                      ncol = 2),
         heights = c(1, 2),    # Heights of the two rows
         widths = c(2, 1)) 
  
  par(mfrow=c(3,3))
  
  m <- ceiling((max((df$SD_in)/10000)+20))
  n <- max(df$CD_in)+10
  barplot(height=df[,2],names.arg=df$Facility
          ,xlab=type,ylab="CD-in",col="orange", main = "in-Degree centrality",
          ylim = c(0,n))
  
  barplot(height=(df[,3])/10000,names.arg=df$Facility
          ,xlab=type,ylab="SD-in(×10e4)",col="light green", main = " in-degree Strength centrality ",
          ylim = c(0,m))
  barplot(height=df[,4],names.arg=df$Facility
          ,xlab=type, ylab="R_absorb",col="light blue", main = " R absorb ",
          ylim = c(0,1))
  
}
Saraghanadian/SNAinSCM documentation built on March 12, 2020, 1:27 a.m.