...+++...
[iramuteq] / Rscripts / afc_graph.R
index ffca92a..e0c2adf 100644 (file)
@@ -31,6 +31,7 @@ tchi <- %s
 tchi.min <- %i
 tchi.max <- %i
 dirout <- '%s'
+do.svg <- %s
 xminmax <- NULL
 yminmax <- NULL
 
@@ -75,21 +76,22 @@ if ( qui == 3 ) {
         ry <- range(table.in[,2], na.rm = TRUE)
         rz <- range(table.in[,3], na.rm = TRUE)
     }
+    eff <- rowSums(afctable)
     if (!is.null(debsup)) {
         if ( qui == 0 ) {
            table.in <- table.in[1:(debsup-1),]
            tablechi <- tablechi[1:(debsup-1),]
-           cex.par <- afc$rowmass[1:(debsup-1)]
+           cex.par <- eff[1:(debsup-1)]
         }
         if ( qui == 1 ) {
            table.in <- table.in[debsup:(debet-1),] 
            tablechi <- tablechi[debsup:(debet-1),]
-           #cex.par <- afc$rowmass[debsup:(debet-1)]
+           cex.par <- eff[debsup:(debet-1)]
         }
         if ( qui == 2 ) {
            table.in <- table.in[debet:nrow(table.in),] 
            tablechi <- tablechi[debet:nrow(tablechi),]
-           #cex.par <- afc$rowmass[debet:nrow(tablechi)]
+           cex.par <- eff[debet:nrow(afctable)]
         }
     }
     
@@ -98,14 +100,14 @@ if ( qui == 3 ) {
             if (!is.null(debet)) {
                 table.in <- table.in[1:(debet-1),] 
                 tablechi <- tablechi[1:(debet-1),]
-                cex.par <- afc$rowmass[1:(debet-1)]
+                cex.par <- eff[1:(debet-1)]
             } else {
-                cex.par <- afc$rowmass
+                cex.par <- eff
             }
         } else {
             table.in <- table.in[debet:nrow(table.in),]
             tablechi <- tablechi[debet:nrow(tablechi),]
-            #cex.par <- afc$rowmass[debet:nrow(tablechi)]
+            cex.par <- eff[debet:nrow(afctable)]
         }
     }
         
@@ -131,7 +133,11 @@ if ( qui == 3 ) {
     infp <-  which(is.infinite(maxchi) & maxchi > 0)
     if (length(infp)) {
         maxchi[infp] <- NA
-        valmax <- max(maxchi, na.rm = TRUE)
+        if (!length(infp) == length(maxchi)) {
+            valmax <- max(maxchi, na.rm = TRUE)
+        } else {
+            valmax <- 8
+        }
         maxchi[infp] <- valmax + 2
     } 
     if (cex.txt) {
@@ -156,7 +162,7 @@ if (is.null(xminmax)) {
 
 if (typegraph == 0) {
 
-    open_file_graph(fileout, width = width, height = height)
+    open_file_graph(fileout, width = width, height = height, svg = do.svg)
     parcex <- taillecar/10
     par(cex = parcex)
     if (over) {