Skip to content
Back to formatted view

Raw Message

Message-ID: <50D3C942.9090105@bitwrit.com.au>
Date: 2012-12-21T02:28:18Z
From: Jim Lemon
Subject: Plot multiple Graphics via Layers
In-Reply-To: <50D34740.5080100@psychologie.tu-dresden.de>

On 12/21/2012 04:13 AM, Anne-Marie Brigitte Gallrein wrote:
> Hello,
>
> I want to plot 13 barplots in a 4x4 matrix-window (1st layer).
> So that's no Problem, it worked out.
>
> The problem is now, that I want to add two additional layers to this
> graphic.
>
> They contain similar barplots, just with another color for the second
> bar of each barplot (2nd layer) and antoher color for the 5th bar of
> each barplot (3rd layer).
> Basically I want to place the 2nd and 3rd pic (attachment) on the first
> one.
>
> I tried "layers", but it is not really working out. I don't really now
> what to do.
>
> Please find attached the 3 pics and the code I wrote.
>
> Thank very much you for your help,
>
> Anne-Marie Gallrein
>
Hi Anne-Marie,
Your illustration didn't come through, but your code did. My guess is 
that you want to do something like this:

layer1 <- apply(X=X[,1:13],
       MARGIN = 2,
       FUN=function(x) {
         barplot(x, horiz=T, xlim=c(-.75,.75), ylim=c(0,10),
         col=c("black","magenta",rep("black",2),
          "dodgerblue",rep("black",4)),
         axes=FALSE, width = .5, space = .5)
         axis(side=1, labels=F)}
       )

Jim