@@ -81,3 +81,74 @@ linePlotEvolution <- function(instance, indicator, algorithmsNames){
81
81
# Create a legend
82
82
legend(" bottomright" , algorithmsNames , cex = 0.6 , col = plot_colors , pch = 21 : 23 , lty = 1 : 3 );
83
83
}
84
+
85
+
86
+ # pt-br version
87
+ linePlotEvolutionPT <- function (instance , indicator , algorithmsNames ){
88
+ # Read data file
89
+ algorithms <- c()
90
+ xmax <- 100 # default #number of steps in evolution process data
91
+ # Define colors to be used
92
+ plot_colors <- c(" blue" ," black" ," orange" ," green" , " brown" , " deepskyblue" , " gray60" ," yellow" )
93
+
94
+ zoommin <- 1 # 40 #plot only from this
95
+ zoommax <- 100 # 99 #at this value
96
+ for (i in 1 : length(algorithmsNames ) ){
97
+ algorithm <- read.table(paste(" ../history/" ,algorithmsNames [i ]," /data_" ,indicator ," _" ,instance ," .dat" ,sep = " " ), header = T , sep = " \t " )
98
+ algorithm <- algorithm [,(- 1 : - zoommin )]# "zoom"at the line
99
+ algorithm <- algorithm [,(- (zoommax - zoommin ): - 100 )]#
100
+ xmax <- length(algorithm )
101
+ algorithms [[i ]] <- algorithm
102
+ }
103
+ # Compute the max and min y
104
+ max_y <- max(unlist(lapply(algorithms ,FUN = max )))
105
+ min_y <- min(unlist(lapply(algorithms ,FUN = min )))
106
+
107
+
108
+ algorithm1mean <- c()
109
+ algorithm1Q <- c()
110
+ algorithm <- algorithms [[1 ]]
111
+ for (n in 1 : xmax ){ # calcules mean, 1o quartil and 3 quartil
112
+ algorithm1mean <- append(algorithm1mean ,mean(algorithm [,n ]))
113
+ algorithm1Q <- rbind(algorithm1Q ,quantile(algorithm [,n ], c(0.25 ,0.75 ),type = 1 ))# rbind is to merge, or, add new line in data frame
114
+ }
115
+
116
+ # FIRST ALGORITHM
117
+ plot(algorithm1mean , type = " o" , pch = ' .' , lty = 1 , col = plot_colors [1 ],
118
+ xaxt = ' n' ,# this axis will be described later
119
+ ylim = c(min_y ,max_y ), # Make y axis
120
+ ann = FALSE )
121
+
122
+ l = seq(0 ,zoommax ,10 )# points where is to plot
123
+ lab = l + zoommin # labels
124
+ axis(1 ,at = l ,labels = lab )
125
+
126
+ lines(algorithm1Q [,1 ], type = " o" , pch = ' .' , lty = 2 , col = plot_colors [1 ])
127
+ lines(algorithm1Q [,2 ], type = " o" , pch = ' .' , lty = 2 , col = plot_colors [1 ])
128
+
129
+ # OTHER ALGORITHMS
130
+ for (i in 2 : length(algorithmsNames )){
131
+ algorithmMean <- c()
132
+ algorithmQ <- c()
133
+ algorithm <- algorithms [[i ]]
134
+ for (n in 1 : xmax ){ # calcules mean, 1o quartil and 3 quartil
135
+ algorithmMean <- append(algorithmMean ,mean(algorithm [,n ]))
136
+ algorithmQ <- rbind(algorithmQ ,quantile(algorithm [,n ], c(0.25 ,0.75 ),type = 1 ))# rbind is to merge, or, add new line in data frame
137
+ }
138
+ lines(algorithmMean , type = " o" , pch = ' .' , lty = 1 , col = plot_colors [i ])
139
+ lines(algorithmQ [,1 ], type = " o" , pch = ' .' , lty = 2 , col = plot_colors [i ])
140
+ lines(algorithmQ [,2 ], type = " o" , pch = ' .' , lty = 2 , col = plot_colors [i ])
141
+ }
142
+
143
+ grid(col = " black" )
144
+ # Create box around plot
145
+ box()
146
+ # Create a title bold/italic font
147
+ title(main = paste(" Evolução do " ,indicator ," : " ,instance ,sep = " " ), font.main = 4 )
148
+ # Label the x and y axes
149
+ title(xlab = " % das avaliações" )
150
+ title(ylab = paste(" Valor do indicador de qualidade " ,indicator ,sep = " " ))
151
+ # Create a legend
152
+ legend(" bottomright" , algorithmsNames , cex = 0.6 , col = plot_colors , pch = 21 : 23 , lty = 1 : 3 );
153
+ }
154
+
0 commit comments