shading in a graph

조회 수: 2 (최근 30일)
mpho bosupeng
mpho bosupeng 2021년 9월 4일
편집: mpho bosupeng 2021년 9월 7일
Hello I want to produce a graph like this with vertical shades (grey) like that. PLEASE how do I shade the data points? I already have the dates for shating, prodblem is how?

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 9월 4일
I don't think there is any plot tool that creates such graph with only data input. However, you can create this by plotting the data using plot() command and add shades (vertical lines) where recessions occured using just stem(), or line(), or plot() again. Here is one simple example:
t = -5:.1:13;
T = sin(t);
plot(t,T, 'm-', 'linewidth', 2), grid on; hold on
warndlg( 'Select 3 Peaks or Downs or Any', 'Selection');
pause(5)
[x, y]=ginput(3);
stem(x(1), y(1), 'r-', 'linewidth', 5)
stem(x(2), y(2), 'g-', 'linewidth', 5)
stem(x(3), y(3), 'b-', 'linewidth', 5)
plot(x(1)*ones(1,10), 'r-', 'linewidth', 5)
  댓글 수: 1
mpho bosupeng
mpho bosupeng 2021년 9월 7일
편집: mpho bosupeng 2021년 9월 7일
@Sulaymon Eshkabilov Thank you for this answer. After searching low and high, I found the answer to be really simple: ECONOMETRIC TOOLBOX. Here it is https://au.mathworks.com/help/econ/recessionplot.html

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

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

제품


릴리스

R12.1

Community Treasure Hunt

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

Start Hunting!

Translated by