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

조회 수: 3 (최근 30일)
Ki Beom Son
Ki Beom Son 2017년 1월 16일
편집: Wilson A N 2017년 1월 20일
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.

채택된 답변

Wilson A N
Wilson A N 2017년 1월 20일
편집: Wilson A N 2017년 1월 20일
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:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by