All the three variables I am using to plot are matrix of size 1x1x100. I am using this code line to plot:
hold on;
for i=1:100
plot3(R_L(:,:,i),N_Pc(:,:,i),CO2_molefraction_top_of_window(:,:,i),'o');
xlabel('R_L');
ylabel('N_P_c');
zlabel('CO_2')
end
However, I am not getting the third axis, and hence the third variable CO2_molefraction_top_of_window on the plot. May I know where am I wrong?
Besides the above question, but on the same subject, I want to know if there is any option where I can plot 4 dimensional plot just like the 3 dimensional plot which can be drawn using plot3?
Just a note — you only need to do the
xlabelylabelzlabelcommands once (outside the loop).Also:
1x1x100instead of just100x1or1x100?Because if you reshape them to 2D you can just do the plotting in one hit.
.
This gives the following, in which you can clearly see three axes:

If it’s the gridlines that you want to make the graph look “more 3D”, then try
grid on(which is in the examples in the Matlab help file forplot3, tryhelp plot3from the Matlab prompt):You will have to clarify “missing third axis” a bit more.