Question

I have a data file with 3 columns and I'd like to plot a 2D map plot. What I do in gnuplot is:

p'datafile' u 1:2:3 with image

for some set of data, the data on the 3rd column (say Z) are different with order of 0.01, e.g 1.56, 1.58, 1.59 etc. I'd like to skip those small difference and consider them all 1.5. How can I set gnuplot to consider only up to one digit after decimal for 3rd column? Thanks!

Was it helpful?

Solution

You can use the floor function to round your numbers down:

plot 'datafile' using 1:2:(floor($3*1e1)/1e1) with image

This sets all your numbers to 1 decimal place. If you wanted to do the same thing for a higher number of decimal places, you could change the 1e1 to 1eN, where N is the number of decimal places you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top