Plot a a matrix by columns but with a different marker for the data at its end

2 次查看(过去 30 天)
I am trying to plot a set of data by introducing the following command
plot11=errorbar(matsizered',matsigmasred',materrred','d','MarkerSize',5)
set(gca,'XScale','log');
xlabel('L/l_e')
ylabel('\sigma_{extinction}')
set(plot11, {'MarkerFaceColor'}, get(plot11,'Color'))
Where matsizered,matsigmasred,materrred are 5x6 matrixes. By doing so, I get the following figure
The question is, can I have the 5 points are the right with an X marker while the other points are still represented by a diamond marker? Thank you very much

采纳的回答

Dana
Dana 2020-9-4
编辑:Dana 2020-9-4
figure
hold on % we need this so that successive plotting commands don't overwrite the previous ones
% only plot error bars for the first 5 columns of your matrices
plot11=errorbar(matsizered(:,1:5)',matsigmasred(:,1:5)',materrred(:,1:5)','d','MarkerSize',5)
hax = gca; % current axis handle
hax.ColorOrderIndex=1; % re-set color order for current axis
% plot the remaining error bars individually in order to get the right colors
for j = 1:5
errorbar(matsizered(j,6),matsigmasred(j,6),materrred(j,6),'x','MarkerSize',5)
end
set(plot11, {'MarkerFaceColor'}, get(plot11,'Color'))
set(gca,'XScale','log');
xlabel('L/l_e')
ylabel('\sigma_{extinction}')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by