我正在使用蒙特卡罗模拟来计算失败的概率,我想在散点直方图中绘制代表失败的点(红色)。我能做到吗?代码在
之下% Histograms
hist(S,20)
hold on
hist(R,40)
set(findobj('Type','patch'),'Facecolor','none','Edgecolor','black')
set(gca,'Fontsize',18,'Fontname','euclid')
xlabel('R & S')
figure
scatterhist(R,S)
xlabel('R'),ylabel('S')
答案 0 :(得分:2)
替换你的行
scatterhist(R,S)
通过以下内容:
h_axes = scatterhist(R, S); %// get handles to the three axes
h_values = get(h_axes(1), 'children'); %// get handle to plotted data
set(h_values, 'XData', R(~I), 'YData', S(~I)); %// remove failures
axes(h_axes(1))
hold on
plot(R(I), S(I), 'ro'); %// put failures back, in red