how to make a contour plot in R?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

how to make a contour plot in R?

Arnau Mir Torres
Hello.

I am an nxn data frame in the variable frame.
I want to make a contour plot with it. That is, I want to plot a square
of dimensions [1,n]x[1,n] with the  gray level of square [i,i+1]x[j,j+1]
equal to frame[i,j].

How can I make it?

Thanks,

Arnau.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: how to make a contour plot in R?

Uwe Ligges
Arnau Mir Torres wrote:

> Hello.
>
> I am an nxn data frame in the variable frame.
> I want to make a contour plot with it. That is, I want to plot a square
> of dimensions [1,n]x[1,n] with the  gray level of square [i,i+1]x[j,j+1]
> equal to frame[i,j].
>
> How can I make it?


See ?image

Uwe Ligges


> Thanks,
>
> Arnau.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: how to make a contour plot in R?

Romain François
In reply to this post by Arnau Mir Torres
Le 13.03.2006 15:58, Arnau Mir Torres a écrit :

> Hello.
>
> I am an nxn data frame in the variable frame.
> I want to make a contour plot with it. That is, I want to plot a square
> of dimensions [1,n]x[1,n] with the  gray level of square [i,i+1]x[j,j+1]
> equal to frame[i,j].
>
> How can I make it?
>
> Thanks,
>
> Arnau.
>  
Hi,

it feels that you want to use ?image with a grey level palette :
R> z <- matrix(runif(100), nc=10)
R> image(z, col=gray(0:10/10))

Also, check ?palette, ?colorRampPalette and the links therein.

HTH

--
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
Discover the R Movies Gallery : http://addictedtor.free.fr/movies
+---------------------------------------------------------------+
| Romain FRANCOIS - http://francoisromain.free.fr               |
| Doctorant INRIA Futurs / EDF                                  |
+---------------------------------------------------------------+

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: how to make a contour plot in R?

Arnau Mir Torres
In reply to this post by Uwe Ligges
Uwe Ligges wrote:

>Arnau Mir Torres wrote:
>
>  
>
>>Hello.
>>
>>I am an nxn data frame in the variable frame.
>>I want to make a contour plot with it. That is, I want to plot a square
>>of dimensions [1,n]x[1,n] with the  gray level of square [i,i+1]x[j,j+1]
>>equal to frame[i,j].
>>
>>How can I make it?
>>    
>>
>
>
>See ?image
>
>Uwe Ligges
>
>
>  
>
>>Thanks,
>>
>>Arnau.
>>
>>______________________________________________
>>[hidden email] mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>>    
>>
>
>______________________________________________
>[hidden email] mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>  
>
The problem is image works with matrices but I am a data frame. So, the
question is: how can I transform a data frame in a matrix?


Arnau.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: how to make a contour plot in R?

antonio rodriguez-3


Arnau Mir Torres wrote:

> Uwe Ligges wrote:
>
>
>>Arnau Mir Torres wrote:
>>
>>
>>
>>
>>>Hello.
>>>
>>>I am an nxn data frame in the variable frame.
>>>I want to make a contour plot with it. That is, I want to plot a square
>>>of dimensions [1,n]x[1,n] with the  gray level of square [i,i+1]x[j,j+1]
>>>equal to frame[i,j].
>>>
>>>How can I make it?
>>>  
>>>
>>
>>
>>See ?image
>>
>>Uwe Ligges
>>
>>
>>
>>
>>
>>>Thanks,
>>>
>>>Arnau.
>>>
>>>______________________________________________
>>>[hidden email] mailing list
>>>https://stat.ethz.ch/mailman/listinfo/r-help
>>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>>>  
>>>
>>
>>______________________________________________
>>[hidden email] mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>>
>>
>>
>
> The problem is image works with matrices but I am a data frame. So, the
> question is: how can I transform a data frame in a matrix?

maybe,

as.matrix()
data.matrix()

Antonio

>
>
> Arnau.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: how to make a contour plot in R?

Uwe Ligges
In reply to this post by Arnau Mir Torres
Arnau Mir Torres wrote:

> Uwe Ligges wrote:
>
>> Arnau Mir Torres wrote:
>>
>>  
>>
>>> Hello.
>>>
>>> I am an nxn data frame in the variable frame.
>>> I want to make a contour plot with it. That is, I want to plot a
>>> square of dimensions [1,n]x[1,n] with the  gray level of square
>>> [i,i+1]x[j,j+1] equal to frame[i,j].
>>>
>>> How can I make it?
>>>  
>>
>>
>>
>> See ?image
>>
>> Uwe Ligges
>>
>>
>>  
>>
>>> Thanks,
>>>
>>> Arnau.
>>>
>>> ______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide!
>>> http://www.R-project.org/posting-guide.html
>>>  
>>
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide!
>> http://www.R-project.org/posting-guide.html
>>
>>  
>>
> The problem is image works with matrices but I am a data frame. So, the
> question is: how can I transform a data frame in a matrix?
>
>
> Arnau.

?as.matrix

Uwe Ligges

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html