3d plot help

12 ビュー (過去 30 日間)
Clement Koh
Clement Koh 2020 年 12 月 15 日
コメント済み: KSSV 2020 年 12 月 15 日
Hey everyone!
I am struggling to plot a 3d graph like the photo that I attached. I have multiple data stating the number of people attending different event over a period of time. Therefore I hope to plot the number of people(z-axis) over the number of days (x-axis). And the different set of data will be plotted side by side along the y axis like shown in the 2 examples tt I showed.
I need help and advice on how I can plot these data, and also shade them in different color to differentiate them!
Thank you for your help in advance!!

回答 (2 件)

KSSV
KSSV 2020 年 12 月 15 日
Something like this:
z1 = rand(10,1) ;
z2 = rand(10,1) ;
x1 = 1:length(z1) ;
x2 = 1:length(z2) ;
y1 = repmat(1,size(x1)) ;
y2 = repmat(10,size(x2)) ;
figure
hold on
patch(x1,y1,z1,'r') ;
patch(x2,y2,z2,'b') ;
view(3)
  2 件のコメント
Clement Koh
Clement Koh 2020 年 12 月 15 日
Thank you for your help! However, my y axis only have 4 events. And when i input my x=0:100, y=[1 2 3 4], z=[1:100], patch(x,y,z), i will get an error where my matrix is not equal. Is it my y axis that is wrong?
P.S. Pretty new to this, so I don really understand some stuff.
KSSV
KSSV 2020 年 12 月 15 日
It will definitely throw error. To use patch all x, y, z should be of same dimension. But still, for your data it will not form a region/ area. It will be a striaght line and you cannot see any colored region.
x=0:100 ;
y= linspace(1,4,length(x)) ;
z=[0:100];
patch(x,y,z),

サインインしてコメントする。


Bjorn Gustavsson
Bjorn Gustavsson 2020 年 12 月 15 日
Have a look at the FEX-submission joyplot, it should give you functions to make these types of plots.
HTH
  1 件のコメント
Clement Koh
Clement Koh 2020 年 12 月 15 日
Thanks! This is really a good function to study!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by