3
votes

I am trying to plot a matrix plot with Gnuplot version 5.0 without interpolation between values.

I am using the following code and data from http://www.gnuplotting.org/tag/matrix/.

However, the image I does not produce discrete regions in the plot and instead interpolates between values. Why is the "with image" option not working?

code

set palette grey
plot 'color_map.dat' matrix with image

with the following data

0 1 2 3 4 3 2 1 0
0 1 2 3 4 3 2 1 0
0 1 2 3 4 3 2 1 0
0 1 2 3 4 3 2 1 0
0 1 2 3 4 3 2 1 0
0 1 2 3 4 3 2 1 0
1
Which output terminal do you use? - Christoph
Your example works fine. Most probably, your problem is related to the viewer you are using, see e.g. stackoverflow.com/q/25736904/2604213 - Christoph
I was using postscript. When I switched to svg it was working fine. Wierd! - user2105632

1 Answers

2
votes

I've been searching for this command for quite some time and stumbled across the answer recently. By using

plot 'color_map.dat' matrix u 1:2:3 with image pixels

one can keep the vectorgraphics (pdf) terminal.

The solution was taken from here.