【发布时间】:2014-10-09 01:51:56
【问题描述】:
我有以下代码:
%initialize variables
titles = {'1a', '1b', '2a', '2b', '3a', '3b', '4a', '4b', '5a', '5b', '6a', '6b', '7a', '7b', '8a', '8b', '9a', '9b', '10a', '10b', '11a', '11b', '12a', '12b', '13a', '13b', '14a'};
antibodies = {'Rel-A','p-Rel-A','IkBa','p-IkBa','A20'};
x_axis = {'PBS','GOX','TNF','L','M','H'};
colours = {'r','g','b','m','c'};
Y_axis = 'Fold TNF (OD)';
%plot graphs
h = figure('name','Cytoplasm,Averaged,1h');
for i=1:5,
subplot(5,1,i)
barwitherr(std_error{2}(i,1:6),averaged_data{2}(i,1:6),'BarWidth',0.7) %note that barwitherr is a downloadable function
set(get(gca,'YLabel'), 'String', Y_axis)
set(gca, 'XTick', 1:6, 'XTickLabel', x_axis,'fontsize',18);
title(antibodies(i))
end
h=subplot(5,1,1);
set(h,'ylim',[0,15]);
h=subplot(5,1,3);
set(h,'ylim',[0,4]);
h=subplot(5,1,4);
set(h,'ylim',[0,4]);
h=subplot(5,1,5);
set(h,'ylim',[0,4]);
这很好地生成了我的图表,除了我想更改各个子图的各个条形的颜色。即,您如何将第一个子图的第一个条更改为绿色,但将其余部分保留为蓝色?
干杯
【问题讨论】:
-
不确定
barwitherr()的工作方式是否相同,但请查看hist 的文档。具体点:“更改直方图颜色属性”。如果您可以使用它,只需使用 if-case 来仅更改您想要的那些图形。 -
No FaceColor 属性不存在此图(无论如何根据错误消息)
-
如果您在
barwitherr()的末尾输入,'r',它会显示为红色吗?如果是这样,您可以输入一个 if-case 来检查它是否是想要的图形,如果是,则使用修改后的“绘图”。不是一个好的解决方案,但应该可以工作 -
很遗憾,这没有用 - 错误消息:“属性值对的输入数量不正确”