How can I draw such plots i.e. storey (y -axis) 0 to 1 > x = constant (assume 5500) and y 1 to 2 > x= 45625.5 ...likewise it follows the pattern...

댓글 수: 2

Rik
Rik 2021년 5월 31일
doc plot
What did you try already?
@Rik I've just tried with the normal plot...but I'm getting sloped line. I've taken one example.
Y =[0 1 2 3 4 5];
X = [0 2100 3456 4856 5641 6452];
plot(X,Y)

댓글을 달려면 로그인하십시오.

 채택된 답변

Star Strider
Star Strider 2021년 5월 31일

0 개 추천

Try something like this —
v = [1 1000 2000]; % Controls Step Offsets
fcn = @(x,v) plot([1 1]+(x+v(1)),[2 3], [(x+v(1)) (x+v(2))], [2 2], [1 1]+(x+v(2)),[1 2], [(x+v(2)) (x+v(3))], [1 1], [1 1]+(x+v(3)),[0 1]);
xv = [100 300 500 1000 1500]; % Beginning ‘x’ Variable
cm = turbo(numel(xv)); % Colormap
figure
hold on
for k1 = 1:numel(xv)
hp{k1} = fcn(xv(k1),v); % Plot ‘Step’
for k2 = 1:numel(hp{k1})
hp{k1}(k2).LineWidth = 2; % Modify Line Width
hp{k1}(k2).Color = cm(k1,:); % Modify Line Color
end
end
hold off
.

댓글 수: 6

Sumit Saha
Sumit Saha 2021년 5월 31일
@Star Strider thanks a lot
Star Strider
Star Strider 2021년 5월 31일
As always, my pleasure!
Sumit Saha
Sumit Saha 2021년 5월 31일
@Star Strider turbo is not working for me...is there any alternate way ?
Star Strider
Star Strider 2021년 5월 31일
Choose whatever colormap you want. Several options could work, such as hsv or jet.
(My apologies, turbo is new in R2021a. I have used it frequently since it appeared.)
Sumit Saha
Sumit Saha 2021년 5월 31일
@Star Strider It's okay. Thanks again.
Star Strider
Star Strider 2021년 5월 31일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Mathieu NOE
Mathieu NOE 2021년 5월 31일

0 개 추천

helllo
simply like this (one curve demo)
% 3 storey plot
x = [ 1 1 2 2 3 3];
y = [5000 4000 4000 3000 3000 2000];
plot(x,y,'r-.','linewidth',2);
xlim([0 5]);

카테고리

도움말 센터File Exchange에서 Labels and Styling에 대해 자세히 알아보기

제품

릴리스

R2017a

질문:

2021년 5월 31일

댓글:

2021년 5월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by