0

I have a text file with three columns. I want to use the first two columns as x and y coordinates and 3rd column as the value at these coordinates. I want to color plot the values. The whole graph should be in 2d(not 3d). Please help

The data points are like

1.0 0.4 0.8
1.2 0.7 0.3
0.8 1.2 -0.5
0.4 0.4 0.0
0.3 0.6 1.2
0.9 1.0 0.5
0.2 0.4 1.0
1.5 0.9 1.4
0.3 1.3 0.3
1.3 1.0 0.4

SrD4443
  • 1
  • 1
  • What have you tried so far? Before you ask new questions which also don't show research effort you may want to respond to comments on your earlier questions. – theozh Apr 06 '23 at 21:33
  • What are these x,y coordinates: regular ones in a orthogonal grid or random ones? How does your data structure and format look like? – theozh Apr 07 '23 at 17:00
  • I have a data file with three columns and 10 rows. The first and second columns should be recognized as x and y coordinates, and the value from the 3rd column should be plotted at that (x, y) point as color indicating the magnitude of the value. – SrD4443 Apr 08 '23 at 09:21
  • Problem solved? Question answered? Any response appreciated. – theozh May 25 '23 at 08:48

1 Answers1

0

You can simply plot points colored from a palette.

Check the manual and gnuplot homepage and tutorials, furthermore, check help palette rgbformulae.

However, from your question it's not clear whether you want the whole area filled with color (e.g. by some interpolation). Then you might want to check help pm3d and this or triangulation or Voronoi graphs.

Script:

### plot with points and palette
reset session

$Data <<EOD
1.0   0.4   0.8
1.2   0.7   0.3
0.8   1.2  -0.5
0.4   0.4   0.0
0.3   0.6   1.2
0.9   1.0   0.5
0.2   0.4   1.0
1.5   0.9   1.4
0.3   1.3   0.3
1.3   1.0   0.4
EOD

set offsets graph 0.05, graph 0.05, graph 0.05, graph 0.05   # add some margin
set grid x,y
set palette rgb 33,13,10

plot $Data u 1:2:3 w p pt 5 ps 5 lc palette z
### end of script

Result:

enter image description here

theozh
  • 22,244
  • 5
  • 28
  • 72