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

4
  • 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. Commented Apr 6, 2023 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? Commented Apr 7, 2023 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. Commented Apr 8, 2023 at 9:21
  • Problem solved? Question answered? Any response appreciated. Commented May 25, 2023 at 8:48

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.