Hi R-listers,
I am having trouble with persp plotting and I hope some knowledgeable
person can help me. I have searched the help files to no avail. I am sure
there is a way of achieving this simple task. I thought in par maybe but
that seems not to work for 3d plots. Maybe I have missed something.
I read in ?persp that it expects increasing values for both my x and y
axes, and a matrix for z. I have been able to graph the data in a way I
like, excepting that the y axis actually decreases (it could be considered
categorical). I'd do this with illustrator or something but it's
something
I'd really like to get a handle on. i've tried reshaping the matrix but
that ruins the visual effect of the data.
All I want to do is substitute some labels for the dummy equally spaced
numbers I have used for the y axis. I am used to levels and such for
replacing ordered sequences of numbers with ordered lists of labels. if I
pass levels(Columns) as the y-axis I get :
non-numeric argument to binary operator
- but I can't work out how to access the labels in any other way.
This is the command I am using :
persp(Rows,Columns,FRm,xlim=c(0,500),theta=28,phi=40,ltheta=20,lphi=135,col='gray',shade=0.7,r=1,box=TRUE,ticktype='detailed',d=1,expand=0.7,xlab='Frequency(Hz)',ylab="Source's
Distance from Floor",zlab='Floor Related Transfer Function(dB)')
with
yaxis :
> Columns
[1] 1 2 3 4 5 6 7 8
x axis :
> Rows
[1] 46.875 93.750 140.625 187.500 234.375 281.250 328.125 375.000 421.875
matrix :
> FRm
V2 V3 V4 V5 V6 V7
46.875 3.0492548 3.1909407 3.29667602 3.3659835 3.3988778 3.39584225
93.75 1.2196200 1.8431528 2.35851554 2.7645735 3.0603714 3.24549087
140.625 -2.2243078 -0.6295752 0.68366429 1.7166743 2.4819218 2.99212770
187.5 -6.2029664 -4.2892634 -1.86802416 0.1535295 1.6414843 2.63151142
234.375 -3.5406118 -5.8918791 -4.97179885 -1.9854102 0.5087716 2.15759798
281.25 0.4005852 -2.4529757 -5.61515030 -4.4797448 -0.9455809 1.56257832
328.125 2.6577261 0.6998110 -2.73925843 -5.8278635 -2.7060864 0.83727527
375 3.5712534 2.6061995 0.05863328 -4.3571602 -4.5478894 -0.02745520
421.875 3.3354403 3.5009804 1.96767411 -1.8611566 -5.6929747 -1.03672351
V8 V9
46.875 3.357792 3.313598
93.75 3.320284 3.309440
140.625 3.257600 3.302508
187.5 3.169483 3.292799
234.375 3.055572 3.280309
281.25 2.915398 3.265032
328.125 2.748382 3.246961
375 2.553836 3.226087
421.875 2.330961 3.202403
R 2.0.0 on MacOSX 10.3.6
Apologies for what is maybe a simple question. It's just really hard to
find the answer.
Thanks
Sam Ferguson