[R] rotating axis labels in plot with multiple plots
Karin Lagesen
karin.lagesen at medisin.uio.no
Fri Aug 18 11:16:03 CEST 2006
I have a plot like this, consisting of 18 different vioplots:
(monospaced font)
----- ----- ----- ----- ----- -----
lab |16 | |13 | |10 | | 7 | | 4 | | 1 |
----- ----- ----- ----- ----- -----
lab |17 | |14 | |11 | | 8 | | 5 | | 2 |
----- ----- ----- ----- ----- -----
lab |18 | |15 | |12 | | 9 | | 6 | | 3 |
----- ----- ----- ----- ----- -----
a b c d e f
This I create in such a way that in the graph itself plot 1 appears in
the top left corner, and plot 18 in the bottom right corner. I then
flip it around when I show it in my paper (it was simpler to do it
that way, this might change:)).
I am now trying to make labels a to f, which are a set of numbers
which are _local_ to each graph group. Now I would like these numbers
to be either vertical to the axis (so that they are in normal text
direction when the paper is rotated so that graphs 18-16 are on top),
or possibly 45 degrees to the plot group.
This is the way I create labels and such:
plot.window(xlim = xlim, ylim = ylim)
axis(2, at = at, labels=toptitle, tick=FALSE)
if(!bottom) {
if(!left){ # nothing > ok
axis(1, at = at, labels = label, tick=FALSE)
}
else{ # not bottom, but left
axis(1, at = at, labels = label, las=2)
}
}
else{
text(lognumbers, par("usr")[3] - 0.25, srt = 135, adj = 1,labels = loglabels, xpd = TRUE)
if(!left){ # bottom, but not left
# want to replace this one with the text
# axis(4, at = lognumbers, labels=loglabels, las=2)
}
else{ # bottom and left > not ok
axis(1, at = at, labels = label, las=2)
# want to replace this one with the text
# axis(4, at = lognumbers, labels=loglabels, las=2)
}
}
}
In this sceme graphs 18-16 are defined as being left, whereas graphs
3, 6, 9, 12, 15, 18 are defined as bottom.
My question relates to my attemt to set nice-looking axis labels using
text. When I put them on as they are shown here, they show up on
(relative to image above) the left side of the "bottom" graphs. How do
I get them to show up on the side I would like them to?
Hope this was somewhat understandable...:)
Karin
--
Karin Lagesen, PhD student
karin.lagesen at medisin.uio.no
http://www.cmbn.no/rognes/
More information about the R-help
mailing list