ShadePlotForEmpahsis
Plots a shaded bar for emphasis ascommonly seen on cconomic charts
INPUTS:
x where the bar is placed. Ifyou want a bar from x=4:8 then
use [4 8]. If you want x=[4:8,10:20] then use{4:8,10:20}
colors Use 'y' to make all barsyellow. Use {'y','g','r'} for
yellow, green and redbars.
alphas Use 0.5 if you want all bars tobe translucent. Use {0,.5,1}
for transparent, translucetand opaque bars.
USAGE:
% DEFINE DATA
P=[ ...
98 98 94 91 84 83 82 87 88 89 91 91 9089 89 90 91 91 87 86 87 84 79 80 ...
85 86 86 85 93 93 93 93 97 97 95 93 9394 95 96 96 92 89 90 91 91 91 92 ...
93 95 99 98 99 97 95 95 94 90 92 93 9395 94 95 93 92 92 92 91 90 89 89 ...
90 89 90 89 88 84 84 83 84 85 85 84 8282 82 79 80 79 80 78 78 81 83 82 ...
81 79 77 77 78 77 78 79 79 81 81 81 7878 78 78 77 78 79 79 79 79 81 85 ...
86 86 86 87 85 84 85 86 88 88 90 88 8887 86 86 85 87 87 87 86 85 84 83 ...
82 81 81 82 81 80 82 81 79 80 81 80 8079 85 85 82 83 84 85 86 87 86 86 ...
85 85 85 83 79 81 83 83 84 82 80 80 8080 84 81 80 76 71 70 70 69 69 68 ...
67 68 68 68 67 68 68 70 70 72 72 71 6968 68 68 67 68 67 66 67 67 67 66 ...
65 66 65 62 60 60 59 59 59 59 65 66 6365 68 68 68 68 69 73 74 71 71 69 ...
71 72 72 76 76 74 77 80 82 80 78 80 8080 80 81 80 79 77];
T=today-length(P)+1:today;
Y={today-[13 74],today-[142172]};
G={today-[30 51]};
% PLOT THE DATA
plot(T,P);
datetick;
line(get(gca,'Xlim'),[8080])
line(get(gca,'Xlim'),[6868])%
title({'ShadePlotForEmphasis','(P<80 yellow,P<68 green)'});
% DRAW SOME YELLOW BARS
ShadePlotForEmpahsis(Y,'y',0.5);
% DRAW A GREEN BAR
ShadePlotForEmpahsis(G,'g',0.5);
| ## _#__/
| ## /#
| ## / #
| /#_/ #
|/ ## #
|__##_____#_____
IT'S NOT FANCY BUT ITWORKS
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。