How to draw a graphic using data with coordinates and production rate?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to draw a graphic using data with coordinates and production rate?

Batur
This post has NOT been accepted by the mailing list yet.
Dear All,

I'm a beginner in using R, and recently doing some statistical analysis. I have a problem using data with coordinates and oil production rate to draw a graphic. The graphic should show the location of every oil rigs and in the same time, every points of those rigs should be in colors according to their production rate kinda like a heat map. For example: the higher production rate the rig has, the deeper color the point shows like this image below.

Could anyone help with that?  I'd really appreciate it!!! Thanks!
Heat map
Reply | Threaded
Open this post in threaded view
|

Re: How to draw a graphic using data with coordinates and production rate?

Daniel Malter
Hi, assuming your production figures are in a square matrix, where points with no production take zero and points with production take the production figure, you could use

image()

This is the most basic approach I would think.

Daniel
Reply | Threaded
Open this post in threaded view
|

Re: How to draw a graphic using data with coordinates and production rate?

Batur
This post has NOT been accepted by the mailing list yet.
In reply to this post by Batur
Hi, Daniel,

First of all, thanks for your reply!
There are three vectors in my data. x is Longitude, y is latitude, z is production rate.

If I use image function, then both x and y should be in ascending order. And I can't make both vectors in that way.

I used plot function and point fucntion to draw the graphic. I just wanna show those points with higher production rate deeper in a same color, while the lower ones look shallow.

Some of those vectors are here:
x<-c(6672140,6700888,6723226,6723226,6712064,6700906,6698044,6683994,6688603,6682663)
y<-c(1515324,1407220,1410714,1410679,1420614,1412834,1412887,1412943,1410689,1408286)
z<-c(1051,718,1107,2555,652,737,738,706,749,799)

In total they are 900 rows.

Any suggestion to use image() function or others?
Reply | Threaded
Open this post in threaded view
|

Re: How to draw a graphic using data with coordinates and production rate?

Daniel Malter
Oh, if plot does the thing, then you just want to specify the color argument accordingly, where the color argument is given by your production figure.

x=seq(1:100)
y=seq(1:100)

x.coord=sample(x,100)
y.coord=sample(y,100)

production=sample(1:100, 100)

plot(y.coord~x.coord)

#now lets say we want full instead of empty points
plot(y.coord~x.coord, pch=16)

#now lets say we want the points blue

plot(y.coord~x.coord, pch=16, col="blue")

#now lets say we want them in the same blue but with saturation varying by the production number
plot(y.coord~x.coord, pch=16, col=rgb(0,0,100,production,maxColorValue=100))

#note that you may want to have maxColorValue=max(production) (or scale the production value accordingly)
#and that you may want to have the color value (here for blue) also at that same value

#now lets do red instead
plot(y.coord~x.coord, pch=16, col=rgb(100,0,0,production,maxColorValue=100))

HTH,
Daniel