[R] plot xyz data in 2D

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Sep 21 16:50:22 CEST 2010


Dear Jacob,

Do you want something like this? Using dummy data instead of yours.
Copy-paste the output of dput() if you want to pass your data in a
format that is easy to use.

library(ggplot2)
dataset <- expand.grid(X = -3:3, Depth = seq(0, -1, by = -0.25))
dataset$Resistivity <- rnorm(nrow(dataset), mean = 1)
ggplot(dataset, aes(x = X, y = Depth, fill = Resistivity)) + geom_tile()

HTH,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
  

> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op r-project.org 
> [mailto:r-help-bounces op r-project.org] Namens Jacob Oosterwijk
> Verzonden: dinsdag 21 september 2010 15:50
> Aan: r-help op r-project.org
> Onderwerp: [R] plot xyz data in 2D
> 
> Hello,
> 
>  
> 
> I want to make an 2D plot of .xyz data. So plot on x-axis and 
> y-axis and use a color scale for the z.
> 
> For every x-location along a cross section of the soil at 
> several depths a resistivity must be displayed. This must 
> result in a picture/graph which shows the resistivity for 
> that cross section. The depths differ for each x-location.
> 
>  
> 
> How can I do that?
> 
>  
> 
> In fact it is an cross section with the following format (simple
> example)
> 
>  
> 
> X
> 
> Depth
> 
> Resistivity
> 
> -3
> 
> 0
> 
> 1
> 
> -2
> 
> -0.25
> 
> 2
> 
> -2
> 
> 0
> 
> 1
> 
> -1
> 
> -0.5
> 
> 3
> 
> -1
> 
> -0.25
> 
> 2
> 
> -1
> 
> 0
> 
> 1
> 
> 0
> 
> -0.75
> 
> 2
> 
> 0
> 
> -0.5
> 
> 3
> 
> 0
> 
> -0.25
> 
> 2
> 
> 0
> 
> 0
> 
> 1
> 
> 1
> 
> -0.5
> 
> 3
> 
> 1
> 
> -0.25
> 
> 2
> 
> 1
> 
> 0
> 
> 1
> 
> 2
> 
> -0.25
> 
> 2
> 
> 2
> 
> 0
> 
> 2
> 
> 3
> 
> 0
> 
> 2
> 
>  
> 
>  
> 
> Acacia Water
> 
> Jan van Beaumontstraat 1
> 
> 2805 RN  Gouda
> 
> The Netherlands
> 
> Tel. office: +31(0) 182686424
> 
> Tel. mobile: +31(0) 6 12143599
> 
> Fax: +31(0)182686239
> 
> Email: jacob.oosterwijk op acaciawater.com 
> <mailto:jacob op acaciawater.com> 
> 
> Website: www.acaciawater.com <http://www.acaciawater.com/> 
> 
>  
> 
>  
> 
> Acacia Water
> 
> Jan van Beaumontstraat 1
> 
> 2805 RN  Gouda
> 
> The Netherlands
> 
> Tel. office: +31(0) 182686424
> 
> Tel. mobile: +31(0) 6 12143599
> 
> Fax: +31(0)182686239
> 
> Email: jacob.oosterwijk op acaciawater.com 
> <mailto:jacob op acaciawater.com> 
> 
> Website: www.acaciawater.com <http://www.acaciawater.com/> 
> 
>  
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help op r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

Druk dit bericht a.u.b. niet onnodig af.
Please do not print this message unnecessarily.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.



More information about the R-help mailing list