我想绘制一系列线,每条线都根据一定的权重着色。我偶然发现了这个,但问题是,我在一张图上绘制了多个东西,其中只有一个绘图语句应该是颜色加权的。
我正在使用hold on; hold off;
,但我只看到最后一张图。因此,最终结果是,我只看到颜色加权的绘图语句,但看不到其他应该绘制的绘图语句hold on; hold off;
。
这是我的代码,其中upper*p
是一个 nx 1 向量,表示 n 行中每一行的强度:
cmap = colormap;
con_min = min(upper*p)*25;
con_max = max(upper*p)*25;
ind_upper = ceil((size(cmap,1)-1)*((con_min:con_max)'-con_min+1)/(con_max-con_min));
subplot(2,3,2);
hold on;
title('Gains');
set(gca,'ColorOrder',cmap(ind_upper,:),'NextPlot','replacechildren');
plot(flat','c');
plot(lower','c');
plot(upper');
set(gca, 'xtick',1:labelFreq:num_tickers, 'xticklabel', tickers(1:4:num_tickers));
ylabel('bp change on day');
colorbar;
caxis([con_min con_max]);
hold off;
似乎根据颜色权重正确绘制了“上部”部分,但未显示“平面”和“下部”图。我认为这是因为 set(gca,...) 语句导致图表重置。