There are several options, the easiest of which is to use the surf function rather than imagesc to plot it.
%set up variables
sigmax = 2;
sigmay = 2;
k = 1;
phi = 0;
initial = -5; %initial degrees as in fig 2.10
final = 5; %final degrees as in fig 2.10
d = 0.01; %steps to compute through
x = initial:d:final; %vector for x values -5>5 degrees as in fig 2.10
y = initial:d:final; %vector for y values -5>5 degrees as in fig 2.10
Ds = zeros(length(x),length(y)); %vector for Ds
%gabor function
for i = 1:length(x)
for j = 1:length(y)
Ds(i,j) = (1/(2*pi*sigmax*sigmay))*(exp(-(((x(i)).^2)./(2*((sigmax).^2)))-(((y(j)).^2)./(2*((sigmay).^2)))))*(cos(k*(x(i))-phi));
end
end
%plot image
figure (1)
surf(x,y,Ds, 'EdgeColor','none')
colormap(turbo)
view(0,90)
xlabel ('x (degrees)')
ylabel ('y (degrees)')
title('Gabor function of spatial receptive field')
.