Add vertical lines on non-numerical x-axis in R

I want to create a graph in R using the image()-function. My x-axis has non-numerical subdivisions. The axis is divided like this: "Arctic Ocean" - "North Atlantic Ocean" - etc. How can I add vertical lines to this axis in order to separate different groups on my axis using the abline(v = [value]) function?

This is the code I used to create the image (which works fine):
par(mar = c(9,9,1,1), bg = "grey90")
n.bins <- 24
image(log10(data.stand), col = colorRampPalette(blues9)(n.bins), xaxt = "n", yaxt = "n", useRaster = F)
axis(side = 2, at = 0:( - 1) / ( - 1), labels = colnames(, las = 1)
axis(side = 1, at = 0:(n.iho.obis - 1) / (n.iho.obis - 1), labels = rownames(, las = 2, cex.axis = 0.5)

I tried implementing the vertical lines using the abline() function, but it doesn't appear on the figure.

Now my question is: how do I implement it correctly in this code? And how can I also make it appear in the figure?



Since you didn't provide x and y arguments to image but only a z matrix, it took by default seq(0,1,nrow(z)) and seq(0,1,ncol(z)) as x and y values. So your vertical lines will have to be expressed in the [0,1] range. Let's say your 10 first columns out of 100 are one group then abline(v=.1) should do the trick. Of course it may be more convenient for you to declare a x and a y directly so you'll have better control on it.

Need Your Help

Is it possible to inject mocks for testing purposes with AndroidAnnotations?

android unit-testing mocking ioc-container android-annotations

I haven't found any examples on how to do this. I'm assuming it is not possible based on examples like this:

Query returns results when it should not


I'm trying to work with the GraceNote web API and I'm getting unexpected results. For example, when I run a query to get the track info for Green Day/Dookie/She I get everything I'm asking for, yet...