I am attempting to create a contour plot using R with this code:
> contour <- as.matrix(read.csv("contour.csv", row.names=1,
header=TRUE))
> library(gplots)
> filled.contour(contour, main="Flume 1 Flow Velocities")
Now this produces the image/plot that I am looking for perfectly. However,
the both axes only go from 0 to 1 instead on of using the row and column
names. To rectify this I tried this:
> filled.contour(contour, axes=FALSE, frame.plot=TRUE)
> matrix.axes <- function(contour)
+ x <- (1:dim(contour)[1] - 1) / (dim(contour)[1] -
1)> axis(side=1, at=x, labels=rownames(contour), las=2)
Error in axis(side = 1, at = x, labels = rownames(contour), las = 2) :
'at' and 'labels' lengths differ, 14 !=
10> x <- (1:dim(contour)[2] - 1) / (dim(contour)[2] - 1)
> axis(side=2, at=x, labels=colnames(contour), las=2)
This did two things. Because I labeled the axes as FALSE, the original axes
labels were removed but the legend labels were also removed which was
undesirable. Also, I was able to label with Y axis with the correct label
using this script but the X axis remained blank. I don't really understand
the error message and I was hoping somebody might be able to shed some
light. So the question is how do I make the column names appear on a contour
plot and how do I apply my own labels without losing the legend label?
I've posted what my .csv file looks like here:
http://docs.google.com/Doc?id=ddqdnxbq_25cm2k6jcq
Any help would be greatly appreciated.
--
View this message in context:
http://www.nabble.com/Axes-in-filled.contour-plots-tp18897760p18897760.html
Sent from the R help mailing list archive at Nabble.com.