字体- FontName
字体大小 - FontSize
设置坐标轴字体 直接在图后 set(gca,'FontSize',20)
设置legend L
L = legend(['FeatureBagging, Auc = ',num2str(Ave.auc(time,2))],['ActiveOutlier, Auc = ',num2str( Ave.auc(time,3))],['LOF, Auc = ',num2str( Ave.auc(time,4))],['ParzenWindow, Auc = ',num2str( Ave.auc(time,5))],['L21, Auc = ',num2str( Ave.auc(time,6))],['L20-4, Auc = ',num2str(
set(L,'Fontname','times new Roman','fontsize',15)
常用字体 - 'times new Roman'
Title
title(['\fontsize{12}\fontname{宋体}汉字 \fontname{Times new roman}this is English,这是汉字,Hello World 123'])
sbuplot 加一个大标题
suptitle('title')
Bar
figure()
b = bar([Accuracy_SVM;Accuracy_DBSCAN;Accuracy_LOF])
hx = [0.8 1 1.2 1.8 2 2.2 2.8 3 3.2]-0.08 % 纵坐标
hy = reshape(cell2mat(get(b,'YData')),1,9)+0.01;
str ={};
限制坐标轴的范围
坐标轴的显示范围?可用axis函数
% 二维
axis([xmin xmax ymin ymax]) %xmin是x最小,xmax是x最大,ymin,ymax类似
% 三维
axis([xmin xmax ymin ymax zmin zmax])
for i=1:length(hy)
str{i} = num2str(hy(i));
end
% 添加标签
text(hx, hy(:)+0.01,str);
title(strcat('Accuracy'))
legend('RP','PCA','Autoencoder')
set(gca,'XTickLabel',{'SVM','DBSCAN','LOF'})
saveas(gcf,strcat(path,'\Synthesis_Accuracy_RobotFailure.fig'))
saveas(gcf,strcat(path,'\Synthesis_Accuracy_RobotFailure.pdf'))
save(strcat(path,'\Info_Synthesis_Accuracy_RobotFailure.mat','Accuracy_SVM','Accuracy_DBSCAN','Accuracy_LOF','AUC_SVM','AUC_LOF'))
set(gca, 'LineWidth',1) % 设置当前图片外围线宽
对于Bar上方的数据位置除了get外有他方法么? 目前我是自己调的