Creating 3d slice plot from various 2d dot plots

조회 수: 4 (최근 30일)
SMA
SMA 2016년 5월 13일
답변: Mike Garrity 2016년 5월 13일
I am having a hard time structuring this question so will gladly explain/clarify.
I have 10 different datasets with different time periods. I have created 2d plots where x-axis is the starting year and y axis is a window and the plot colors and circle size represent different values. Now I'd like to get all the datasets in a single 3d 'slice' plot where z-axis is window, x-axis is year and y-axis is name of the dataset.
For example; the attached figure (Test) is a sample 2d plot and there are 10 of these with different x-axis year and the second attached figure (net) is what I am hoping for (except it will be scatter not a surface).

답변 (1개)

Mike Garrity
Mike Garrity 2016년 5월 13일
So you have something like this:
npts = 120;
for i=1:10
years(i,:) = randi(50,[1 npts]);
windows(i,:) = randn(1,npts);
end
for i=1:10
subplot(10,1,i)
scatter(years(i,:),windows(i,:),'filled')
end
You can use scatter3 with a constant for Y like this:
for i=1:10
scatter3(windows(i,:),i+zeros(1,npts),years(i,:),'filled')
hold on
end
xlabel('Window')
ylabel('Dataset')
zlabel('Year')
view(-70,24)
Cycling through the colors is the default behaviour. You can set a color in each call to scatter3 if you don't want that.

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by