MATLAB: I want to plot different sized vector but fitted size in axes

contourdifferent contourdifferent plotdifferent size vectorfittedfitted lengthfitted plothold onplot 3d 2dsurf contour

I want to plot A which is contour and B which is scatter 3d on same axes.
But they have different size so i can't plot same size. ex) A = 300 X 300, B = 100 X 100
if i increase B's size and relocation B's value, it will fine. But i can't use this method.
So i want to know to plot different sized vector but fitted size in axes. like as one is background picture.
My goal is contour A that is used floor(z=0), and surf 3d B(z=0~h) above the A.

Best Answer

You can check the code given below:
% Creating a surface and contour plot together with the surfc command
[X,Y,Z] = peaks(30);
figure
k = surfc(X,Y,Z)
% Creating another plot for the contour plot with different dimension data
p = linspace(-2*pi,2*pi);
q = linspace(0,4*pi);
[P,Q] = meshgrid(p,q);
R = sin(P)+cos(Q);
% Assigning and plotting the contour plot of the surface plot with the new data.
k(2).XData = P;
k(2).YData = Q;
k(2).ZData = R;
Here the new contour plot is of different dimension and it gets plotted below the surface plot of another dimension. More information on the 'surfc' command is given in the link below:
You can also hide the desired data points in the plot by assigning the data point to NaN. The following link shows how to hide data points: