MATLAB: How to remove the space between plotted data and the axis (surf)

3d plotsaxisspace between plot and axissurf

Is it possible to remove the space between the axis and the plot? The problem:
I using surf and x-y view. Other plot functions such as contour are not an option in my case.
Minimum working example:
plot_data=rand(25,25);
surf(plot_data)
grid on
axis square
set(gcf,'color','w')
view(0, 90)
Thanks for the help!

Best Answer

Adding ‘axis tight’ seems to do what you want:
plot_data=rand(25,25);
surf(plot_data)
grid on
axis square
set(gcf,'color','w')
view(0, 90)
axis tight
To wit: