Hello,
I've a problem aligning tickmarks to an image. I've created a
correlation matrix for 84 datasets. I'm visualizing the matrix as an image
with colour coding according to the correlation coefficient.
The 84 datasets are distributed over three factors, but the desgin is
unbalanced, so that the tickmarks and the lables for the axis must not evenly
distributed. A regular grid via the 'grid' function aligns perfectly
with the image cells, but the tickmarks via "axis" are slightely
shifted, and not aligned perfectly with the image cells. The offset is even
stonger for the y-axis. The thing is that I don't want 84 lables at the
axis, it's enough to have one lable for all the different factor level
combinations, which results in 28 labels.
Maybe you have an idea how to setup the command to align the tick marks
properly.
thanks for your help, kind regards,
Arne
Here are my commands:
> library(marrayPlots) # for the colors
> col <- maPalette(low='white', high='darkred', k=50)
> par(ps=8, cex=1, mar=c(1,5,5,1)) # space needed for lables @ axis 1 and 3
# x and y range from 1 to 84, x is the correlation matrix (dim =
84x84)> image(1:84, 1:84, x, col=col, xaxt='n', yaxt='n',
xlab='', ylab='')
# set up the axis, 28 lables, distributed un-evenly over the image
axis> axis(3, i, labels=names(l), las=2, tick=T)
> axis(2, i, labels=names(l), las=2, tick=T)
> grid(84, col='black', lty='solid') # grids each of the 84
cells
# this is where the lables come form, the number indicate the replicates
# per factor-level combinations> l
NEW:4:0 NEW:4:100 NEW:4:250 NEW:4:500 NEW:4:1000 NEW:24:0
3 3 3 3 3 3
NEW:24:100 NEW:24:250 NEW:24:500 NEW:24:1000 OLD:4:0 OLD:4:100
3 3 3 3 4 3
OLD:4:250 OLD:4:500 OLD:4:1000 OLD:24:0 OLD:24:100 OLD:24:250
2 3 3 4 3 2
OLD:24:500 OLD:24:1000 PRG:4:0 PRG:4:100 PRG:4:250 PRG:4:1000
3 3 3 3 3 3
PRG:24:0 PRG:24:100 PRG:24:250 PRG:24:1000
3 3 3 3
# these are the positions along the axis for the tick marks,
# replicates from 1 to 3 (replicates of one factor-evel combination), 4 to 6
# ...> i
[1] 3 6 9 12 15 18 21 24 27 30 34 37 39 42 45 49 52 54 57 60 63 66 69 72 75
[26] 78 81 84