[R] plot questions?-errors in persp(x1, x2, y) and contour(x1, x2, y)

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Nov 7 11:50:35 CET 2006



zhijie zhang wrote:
> Dear Uwe Ligges ,
>  I still can't finish it.
> *> aa*   #my data
>    x1 x2      y
> 5    0.05  6 4.4180
> 1    0.50  3 2.6979
> 4    0.50  9 2.9000
> 7    0.95  6 2.6230
> 8    0.95  6 2.9078
> 9    0.95  6 2.6727
> 3    1.40  3 2.4203
> 2    1.40  9 2.5329
> 6   1.85  6 2.4867
> *> attach(aa)*
> *> persp(x1,x2,y*
> error in persp.default(x1, x2, y) : increasing 'x' and 'y' values expected
> *> contour(x1,x2,y)*
> error in contour.default(x1, x2, y) : increasing 'x' and 'y' values 
> expected
> What's the problem? And could u recommend a book for me?
> Thanks again.


Well, your x and y coordinates must be equidistant and z a corresponding 
matrix. Please read the help files. If you cannot provide this data, a 
grid seems inappropriate.

For a book: Paul Murrell wrote some nice book about "R Graphics".

Uwe Ligges


> 
> On 11/7/06, Uwe Ligges <ligges at statistik.uni-dortmund.de> wrote:
>>
>>
>>
>> zhijie zhang wrote:
>> > Dear Rusers,
>> >   I want to know which function in R can perform the following tasks:
>> > 1.surface-data grid(x,y,z)  #which could be done in splus, the name was
>> from
>> > splus's options of graph
>> > 2. contourplot(x,y,z)     #which could be done in splus
>> > By the way, where can i find some useful materials to learn to plot
>> > 3-dimensionel graphs?
>> > Thanks!
>> >
>>
>> 1. persp()
>> 2. contour()
>> 3. E.g., look into a good book about R.
>>
>> Uwe Ligges
>>
> 
> 
>



More information about the R-help mailing list