Skip to content
Prev 13437 / 29559 Next

Legend in density plot

On 18/11/11 21:13, Albin Blaschka wrote:
I ***think*** when you say ``legend'' you mean the ***ribbon*** that 
appears at
the right hand side of an "im" plot.  And I ***think*** you want this 
ribbon to cover
the same range of values for each plot.

This is easily done --- choose the range of values that you want to use, 
and invoke
the argument "zlim".

Here's a toy example:

X <- im(matrix(runif(10000),100,100))
Y <- im(matrix(runif(10000,0.5,1.5),100,100))
plot(X) # No adjustment --- the two images look pretty much the same;
plot(Y) # you can't see the difference in the ranges of values.

plot(X,zlim=c(0,1.5))
plot(Y,zlim=c(0,1.5)) # Now the difference is obvious.

I hope I have interpreted your question correctly.  If not, please let me
know, with clarifications.

     cheers,

         Rolf Turner