网上的介绍真是良莠不齐,终于自己摸索出来!!!
1,如果要把图例标注的文字加粗,则在legend1参数里面
%这句参数可修改图例标注的位置,和字体,耶,'Location','SouthEast'
legend1=legend('FontName','Times New Roman',tmpName,'Interpreter', 'none','fontsize',fontSizeLegend,'Location','SouthEast');
title(titleName,'fontsize',fontSize,'FontName','Times New Roman');
xlabel(xLabelName,'fontsize',fontSize,'FontName','Times New Roman');
ylabel(yLabelName,'fontsize',fontSize,'FontName','Times New Roman');
set(gca,'fontweight','bold');%添加这句可以增加横纵坐标轴粗细
2,如果只要把x轴刻度加粗,那就更改xlabel里面的参数'fontweight','bold'
3,如果只要把y轴刻度加粗,那就更改ylabel里面的参数'fontweight','bold'文章来源:https://www.toymoban.com/news/detail-507875.html
可能代码不够完整,这个是我数据集benchmark的源代码,也是在这个基础上加粗字体文章来源地址https://www.toymoban.com/news/detail-507875.html
function plotDrawSave(numTrk,plotDrawStyle,aveSuccessRatePlot,idxSeqSet,rankNum,rankingType,rankIdx,nameTrkAll,thresholdSet,titleName,xLabelName,yLabelName,figName,metricType)
aveSuccessRate11=[];
scrsz = get(0,'ScreenSize');
for idxTrk=1:numTrk
%each row is the sr plot of one sequence
tmp=aveSuccessRatePlot(idxTrk, idxSeqSet,:);
aa=reshape(tmp,[length(idxSeqSet),size(aveSuccessRatePlot,3)]);
aa=aa(sum(aa,2)>eps,:);
bb=mean(aa);
switch rankingType
case 'AUC'
perf(idxTrk) = mean(bb);
case 'threshold'
perf(idxTrk) = bb(rankIdx);
end
end
[tmp,indexSort]=sort(perf,'descend');
i=1;
AUC=[];
fontSize = 16;
fontSizeLegend = 10;
figure1 = figure;
axes1 = axes('Parent',figure1,'FontSize',14);
set(gca,'fontweight','bold'); %可以加粗图例的字体
for idxTrk=indexSort(1:rankNum)
tmp=aveSuccessRatePlot(idxTrk,idxSeqSet,:);
aa=reshape(tmp,[length(idxSeqSet),size(aveSuccessRatePlot,3)]);
aa=aa(sum(aa,2)>eps,:);
bb=mean(aa);
switch rankingType
case 'AUC'
score = mean(bb);
tmp=sprintf('%.3f', score);
case 'threshold'
score = bb(rankIdx);
tmp=sprintf('%.3f', score);
end
tmpName{i} = [nameTrkAll{idxTrk} ' [' tmp ']'];
h(i) = plot(thresholdSet,bb,'color',plotDrawStyle{i}.color, 'lineStyle', plotDrawStyle{i}.lineStyle,'lineWidth', 2,'Parent',axes1);
set(gca,'fontweight','bold');%添加的增加横纵坐标轴粗细
hold on
i=i+1;
end
%可修改图例标注的位置(右下角),和字体,耶,SouthEast
legend1=legend('FontName','Times New Roman',tmpName,'Interpreter', 'none','fontsize',fontSizeLegend,'Location','SouthWest');
%可以加粗图例的字体
title(titleName,'fontsize',fontSize,'FontName','Times New Roman','fontweight','bold');
xlabel(xLabelName,'fontsize',fontSize,'FontName','Times New Roman');
ylabel(yLabelName,'fontsize',fontSize,'FontName','Times New Roman');
到了这里,关于matlab如何设置横纵坐标轴的字体粗细的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!