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

18 views (last 30 days)
Ki Beom Son
Ki Beom Son on 16 Jan 2017
Edited: Wilson A N on 20 Jan 2017
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.

Accepted Answer

Wilson A N
Wilson A N on 20 Jan 2017
Edited: Wilson A N on 20 Jan 2017
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:

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by