plot - How to make array of filled contour graphs in R -
i have value function of 4 independent real variables , want 2d array of filled contour plots visualise behaviour.
to simplify problem, let's array 1 created following loop:
values.to.contour<-array(0,rep(5,4)) (i1 in 1:5){ (i2 in 1:5){ (i3 in 1:5){ (i4 in 1:5){ values.to.contour[i1,i2,i3,i4] <- sin(i1*2*pi/5) * sin(i2*2*pi*2/5) * sin(i3*2*pi*3/5) * sin(i4*2*pi*4/5) } } } }
i can non-filled contour plots following code:
par(mfcol=c(5, 5), oma=rep(0.5,4), mai=rep(0.2,4) ) (i3 in 1:5){ # loop 3 (i4 in 1:5){ # loop 4 #filled.contour(x=1:5 * 2 * pi * 3 / 5, y=1:5 * 2 * pi * 4 / 5, z=t(values.to.contour[ , , i3, i4]), levels = 0.25 * 0:8 -1, color.palette = rainbow) contour(x=1:5 * 2 * pi * 3 / 5, y=1:5 * 2 * pi * 4 / 5, z=t(values.to.contour[ , , i3, i4]), levels = 0.25 * 0:8 -1) } }
that produces 5 x 5 array of contour plots, want.
but when try filled.contour final plot, full size, rather array of plots.
par(mfcol=c(5, 5), oma=rep(0.5,4), mai=rep(0.2,4) ) (i3 in 1:5){ # loop 3 (i4 in 1:5){ # loop 4 filled.contour(x=1:5 * 2 * pi * 3 / 5, y=1:5 * 2 * pi * 4 / 5, z=t(values.to.contour[ , , i3, i4]), levels = 0.25 * 0:8 -1, color.palette = rainbow) #contour(x=1:5 * 2 * pi * 3 / 5, y=1:5 * 2 * pi * 4 / 5, z=t(values.to.contour[ , , i3, i4]), levels = 0.25 * 0:8 -1) } }
can suggest way of making 25 filled.contour plots appear in 5 x 5 array contour plots do?
also, can suggest how make
- the colour guide appear once, or @ 5 times (say @ rhs of each row of plots), rather @ rhs of every 1 of 25 plots
- x axis tick labels appear on bottom row of plots and
- y axis tick labels appear on left hand column of plots?
thank assistance
andrew
Comments
Post a Comment