I have a three column data that I want to plot as a 2D color map. The first column represents the x axis and the second represents the y axis. However the values in these are not in the form of a regular interval grid, with the data for the third column being available at rather random points in the 2D space. I have given a sample dataset below. The actual dataset is many thousands of lines long.
X1 X2 X3
1 0.000000 NaN 1760
2 1.000000 0.0000000 1536
3 2.000000 0.0000000 1744
4 3.000000 0.0000000 1632
5 1.000000 1.5707963 1616
6 1.414214 0.7853982 1632
7 2.236068 0.4636476 1712
8 3.162278 0.3217506 1616
9 2.000000 1.5707963 1616
10 2.236068 1.1071487 1568
11 2.828427 0.7853982 1712
12 3.605551 0.5880026 1600
13 3.000000 1.5707963 1536
14 3.162278 1.2490458 1536
15 3.605551 0.9827937 1568
16 4.242641 0.7853982 1536
This data was obtained by actually "melting" (library reshape) a cartesian grid with values (raster), and then converting into polar coordinates, with an intent to plot the r and theta. The first column is r, the second is theta and the third is the intensity of the raster pixels. I want to be able to plot the values of the third column at the grid locations (on linear axes) as defined by the corresponding values of the first and second column. So, for example, taking the second row, the value of 1536 represented on a color scale at a location of (1,0)
I looked at a lot of options such as heatmaps, and found some help for matlab or python, but I want to be able to do this in R. Is there any way to accomplish this? Bonus if I am able to adjust the color scale etc.
To clarify, the first and second column have to be represented as linear axes itself (I explained the part about the r and theta to explain the origin of the data). I would hope the end result would be something like this:
Hope it helps!