s-news
[Top] [All Lists]

[S] graphsheet(format = printer)

To: s-news@wubios.wustl.edu
Subject: [S] graphsheet(format = printer)
From: "Gérald Jean" <Gerald.Jean@spgdag.ca>
Date: Fri, 29 Oct 1999 10:54:40 -0400
Sender: owner-s-news@wubios.wustl.edu
Hello s-users,

The following chunck of code sends several plots to the printer.  Everything
works fine but!

Why is the last plot not sent to the printer.  I run this function often and it
is allways the same thing:  Iprint, setted as T, gets passed as argument to the
function and all plots go to the printer but the last one, why? and how to
modify that behaviour?

Thanks,

Gérald Jean
Analyste-conseil (statistiques), Actuariat
télephone            : (418) 835-8839
télecopieur          : (418) 835-5865
courrier électronique: gerald.jean@spgdag.ca

"In God we trust all others must bring data"

#.....snip

  if (Iprint) graphsheet(format = 'printer')
  oldpar <- par()
  on.exit(par(oldpar))
  par(mar = c(5,4,4,5) + 0.1)
  j <- 1
  for (i in 1:length(factors))
    { k        <- j - 1 + length(factors[[i]])
      mat.plot <- plot.matrix[j:k,]
      mylabels <- Permute(ind = reflev.ind[i], factors[[i]])
      j        <- k + 1

      cat (paste('   Graphique de ', names(factors[i]), sep = ''), sep = '\n')

#.....Note: the "+15" in the "ylim" parameter insures that the lowest point of
#            the next plot won't touch the top of the bar.

      par(tck = 0.02)
      ticks.loc  <- barplot(mat.plot[,3], axes = F,
                           ylim = c(0,2*max(mat.plot[,3]) + 15))
      pretty.bar <-pretty(c(0, mat.plot[,3]), 6)
      axis(side = 4, at = pretty.bar)
      my.axis (side = 1, at = ticks.loc, labels = abbreviate(mylabels,
               minlength = 8), crt = 45, col = 1,
              adj = 0.5, cex = 0.80, mgp = c(3.0,2.5,0))
      box()
      min.y        <- range(mat.plot[,1])
      pts.lab.coor <- mat.plot[,1] - (min.y[2] - min.y[1]) / 10
      min.y        <- min(mat.plot[,1]) - 1.25 * (min.y[2] - min.y[1])
      par(xaxs = 'd', new = T)
#      par(tck = 1)
      plot(ticks.loc, mat.plot[,1], type = 'b', col = 8,
                             axes = F,
                             xlab = '',
                             ylab = '',
                             ylim = c(min.y, max(mat.plot[,1])),
                             lwd  = 1.5)
      pretty.plot <- pretty(mat.plot[,1], 5)
      if (min(mat.plot[,1]) == 1)
           pretty.plot <- pretty.plot[pretty.plot >= 1]
      axis(side = 2, at = pretty.plot)
      abline( h = pretty.plot, lty = 8, err = -1)
      title(main = paste(sinistre, '---', names(factors)[i], sep = ' '),
            xlab = '',
            ylab = 'Diff\351rentiel',
            col  = 1)
      mtext(side = 4, line = 3.3, 'P\351n\351tration Pond\351r\351e en %', col =
 1)
      text(ticks.loc, pts.lab.coor, as.character(round(mat.plot[,2], digits =
2)))
      par(xaxs = 'r')
    }


-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] graphsheet(format = printer), "Gérald Jean" <=