Skip to content

corrgram

4 messages · paladini, Kevin Wright, Bert Gunter

#
Hallo,
  I have a question concerning the function "correlogram" from
library(corrgram).

Is it possible do write the variable names not in the diagonal  but on 
the left and at the buttom of the graphic?
I searched the manual and tried a lot but didn't get it.


Thank you very much and best regards


Claudia
#
Claudia, When you are asking a question about a particular _package_,
you should try to contact the package maintainer with the question.

Now, to answer your question...There is no simple way.  You can always
use the "grid" package to annotate plots however you like.  Here is an
example that shows how it _could_ be done.  Ugly, however.

side.txt <- function (x = 0.5, y = 0.5, txt, cex, font, srt) {
  NULL
}

corrgram(mtcars[2:6], order=TRUE,
         labels=c('Axle
ratio','Weight','Displacement','Cylinders','Horsepower'),
         cex.labels=1.5,
         upper.panel=panel.conf, lower.panel=panel.pie,
         diag.panel=panel.minmax, text.panel=side.txt)

require("grid")
grid.clip()
lab <- "Displacement"

pushViewport(viewport(.04, .5, width = stringWidth(lab), angle=90,
                      height = unit(2, "lines"), name = "pagenum", gp
= gpar(fontsize = 8)))
grid.text(lab, gp=gpar(srt=45), just = c("left", "bottom"))
popViewport()

pushViewport(viewport(.5, .04, width = stringWidth(lab),
                      height = unit(2, "lines"), name = "pagenum", gp
= gpar(fontsize = 8)))
grid.text(lab, gp=gpar(srt=45), just = c("left", "bottom"))
popViewport()
On Tue, Sep 25, 2012 at 4:54 AM, paladini <paladini at beuth-hochschule.de> wrote:

  
    
#
Inline:
On Tue, Sep 25, 2012 at 8:42 AM, Kevin Wright <kw.stat at gmail.com> wrote:
This is false of course. What you meant to say (I hope) is that you
can use the grid package to annotate any plot drawn **with grid
graphics** any way you light. This includes both the lattice and
ggplot packages. As you said, the exact details of how to do it may
not be exactly transparent (and I don't know whether they are or not
in this case).

Graphics drawn with the base graphics functionality are generally
incompatible with grid graphics.

Cheers,
Bert

 Here is an

  
    
#
Um, Bert, did you try my example?  It uses grid graphics to annotate a
base-graphics plot.

Kevin
On Tue, Sep 25, 2012 at 10:50 AM, Bert Gunter <gunter.berton at gene.com> wrote: