My question was thus;

Given

  library(lattice)
  my.m <- matrix(seq(1,100,1),nrow=10)
  levelplot(my.m)


How can I add a diagonal line onto the resulting 'color square'?

The answer I found was to hack the 'panel.levelplot' function. Here is the
diff between the old (panel.levplot) and the new (my.panel.levplot)
functions;

***************
*** 72,77 ****
--- 82,89 ----
                    shrinky[2], fullZrange), default.units = "native",
                  gp = gpar(fill = col.regions[zcol], lwd = 1e-05,
                    col = "transparent", alpha = alpha.regions))
+     ## Added by Dan
+     panel.abline(0,1,col="white")
      if (contour) {
        if (is.logical(labels) && !labels)
          labels <- NULL


And then use...

  library(lattice)
  my.m <- matrix(seq(1,100,1),nrow=10)
  levelplot(my.m, panel=my.panel.levelplot)


I accidentally started to talk to Charilaos Skiadas 'off-list', so thanks to
him for help.

Dan.

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to