I have a question about the R function image
in the biwavelet
package. This function is used to plot correlation values as the z
in the image
function. I'm plotting perfectly correlated data sets (R-squared=1 as my z-value). When the image is plotted there is some variation in the colored boxes. I'm confused by this because all the values in my z
matrix are 1. Any ideas why this could be happening, and how to fix it?
image(x$t, yvals, t(zvals), zlim = zlim, xlim = xlim, ylim = rev(ylim),
xlab = "Time", ylab = "Period", yaxt = "n", xaxt = "n", col = fill.colors)
zvals
is a matrix of all 1s
UPDATE: based on request below
x$t
[1] 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
[29] 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012
yvals
[1] 1.046901 1.130235 1.213568 1.296901 1.380235 1.463568 1.546901 1.630235 1.713568 1.796901 1.880235 1.963568 2.046901 2.130235 2.213568
[16] 2.296901 2.380235 2.463568 2.546901 2.630235 2.713568 2.796901 2.880235 2.963568 3.046901 3.130235 3.213568 3.296901 3.380235 3.463568
[31] 3.546901 3.630235 3.713568 3.796901
str(zvals)
num [1:34, 1:40] 1 1 1 1 1 1 1 1 1 1 ...
Above are the actual data. Below is an example, but plots as expected, whereas my data do not:
a <- 1980:2010
y <- sort( rnorm(30,2,.5) )
z <- matrix(nrow=30,ncol=31,1)
image(a, y, t(z), zlim = range(z), xlim = range(a), ylim = rev(range(y)), col = heat.colors(n=20))