2
votes

I have a sparse grid of data that I would like to plot with a log scale in the x and y axes, with colours and contours defining the z axis.

Using logscale xy results in a very different looking plot to when I plot a linear plot of the log of each axis.

Using logscale xy

Linear plot of logged values

I want the nice logarithmic axes and positioning of the contour legend of the first plot, with the nice central portion and colour scale of the second plot.

My current script is

set dgrid3d 50,50 splines
set pm3d
set pm3d map

set cntrparam levels auto
set contour surface

#set logscale xy
#splot "test_data.dat" using 1:2:3 with l nosurf lw 3
splot "test_data.dat" using (log10($1)):(log10($2)):3 with lines nosurf lw 3

where I change the comments to change which plots I make.

What am I doing wrong?

All suggestions will be gladly accepted.

edit: Through some more research, I think that the data is being gridded by dgrid3d in linear space, and then plotted in log space by logscale xy. I want the data to be gridded and plotted in log space.

Is there a gnuplot-only solution?

1

1 Answers

0
votes

Two-fold solution. 1) the difference in the look of the plots was due to a bug in 5.2.2. Upgrade to 5.2.3 fixed it. 2) Solved the gridding issue by plotting the log of the data on linear axes and then bodging the axes to look logarithmic.

The plot needs to be improved by making the minor tics smaller than the major.

"Fixed" plot

set pm3d
set pm3d map
set cntrparam levels auto
set contour surface

#set xrange [2:6] #setting this makes the image finish at the y2 tics, without changing the xtics
set xtics 2,1,6
unset xtics

# "major" tics
set xtics ("100" 2, "1000" 3, "10000" 4, "100000" 5, "1e6" 6)
# "minor" ticks
set for [i=2:6:1] xtics add ("" log10(2*10**i),"" log10(3*10**i),"" log10(4*10**i),"" log10(5*10**i), "" log10(6*10**i),"" log10(7*10**i),"" log10(8*10**i),"" log10(9*10**i)) 

set ytics -2,1,-1
unset ytics
set ytics ("0.01" -2, "0.1" -1)
set for [i=-3:0:1] ytics add ("" log10(2*10**i),"" log10(3*10**i),"" log10(4*10**i),"" log10(5*10**i), "" log10(6*10**i),"" log10(7*10**i),"" log10(8*10**i),"" log10(9*10**i)) 

splot "test_data.dat" using (log10($1)):(log10($2)):3