1

I have run into a strange problem. Every time I try to plot "with image" using a non-square data file I get very unexpected results. Nowhere in any of the sources I've read mentioned anything about whether the domain needed to have the same dimensions.

For example, I have a file called plate which consists of many datablocks each with 4 tab-separated columns. The second and third columns represent x and y coordinates respectively. The first datablock in plate goes like:

0       0       0       293
0       0       0.1     293
.       .       .       .
.       .       .       .
.       .       .       .
0       5       4.9     293
0       5       5       293

When I plot "plate" index 0 using 2:3:4 with image I get the expected result. This works for every index and the result is a square heat map with the 4th column as the heat value. I want to do the same with my file called pipe, which uses the same format except for different ranges on columns 2 and 3.

0       5       2.2     293
0       5       2.3     293
.       .       .       .
.       .       .       .
.       .       .       .
0       10      2.9     293
0       10      3       293

Currently, I get the following:

enter image description here

The output should show a solid horizontal bar adjacent to the square but instead it is distorted.

I have tried other non-square data files and the results were even different from the attached image. One attempt basically doubled the image but kept it square, even when the data wasn't.

Below is a truncated sample of pipe for testing.

0       5       2.2     293
0       5       2.3     293
0       5       2.4     293
0       5       2.5     293
0       5       2.6     293
0       5       2.7     293
0       5       2.8     293
0       5       2.9     293
0       5       3       293
0       5.1     2.2     293
0       5.1     2.3     293
0       5.1     2.4     293
0       5.1     2.5     293
0       5.1     2.6     293
0       5.1     2.7     293
0       5.1     2.8     293
0       5.1     2.9     293
0       5.1     3       293
2
  • Could you please provide the complete data or at least a minimal set of data which shows this effect? Commented Feb 14, 2020 at 21:44
  • @theozh Done, I get the same effect with this file when running ```plot "<file>" using 2:3:4 with image" Commented Feb 14, 2020 at 22:38

1 Answer 1

2

Ok I stumbled upon a solution, but I don't really know why it is the case or how to avoid it using gnuplot instead of rewriting the entire data file.

In the case of non-square data the problem seems to be that the column to be read first in the using statement needs also to be the column that is iterated over first.

For data that goes

1       1       1
1       2       2
1       3       3
2       1       4
2       2       5
2       3       6

Plotting by using 1:2:3 with image will result in a parallelogram, but plotting with using 2:1:3 with image will plot with the proper dimensions. However, in the latter case the desired x-axis will be plotted on the y and vice versa. I also added sequential test points in the above data to see where each square is drawn.

Attached below are results from the test data listed above.

plot "test" using 1:2:3 with image

plot "test" using 2:1:3 with image

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.