MATLAB: Managing surface plot axis

axiscolorbarsurface plot

I wonder if it is possible to plot a surface in matlab while changing the x, y and z axis.
I don't want to have my z value upwards. I want to have it in x direction instead.
The problem here is the colorbar which is based on the z value. Even if I change the order of my data points, matlab always consider the z value for the colorbar.
Thank you very much in advance.

Best Answer

Have you tried using your X data as the surface color input C? Adapting this doc example.
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
surf(X,Y,Z,X)
xlabel("X")
ylabel("Y")
zlabel("Z")
colorbar