【问题标题】:Matlab Figure ErrorMatlab图形错误
【发布时间】:2018-03-30 10:55:35
【问题描述】:

从过去几天开始,我在保存 matlab 绘图时得到了这个看起来很糟糕的数字。看到这个:

有人知道为什么会这样吗?

这是我正在使用的绘图代码:

plot(x,y,'o','MarkerSize',7,'MarkerFaceColor',[0.8 0.8 
0.8],'MarkerEdgeColor',[0 0 0]);
[myfit,gof,output] = fit(x,y,'poly1');
hold on
myfitplot = plot(myfit);
set(myfitplot,'Color','k')
set(gca,'FontName','Calibri');
set(gca, 'FontSize',11);
set(gca, 'XTick',[ 0.5,0.52, 0.54])
set(gca, 'YTick',[ 0.48 ,0.54,0.6])
%set(gca, 'XLim',[0.45, 0.6])
%set(gca,'Ylim',[0.45, 0.6])
xlabel('\it{CI_{ETn}}','FontName', 'Calibri','FontSize',15,'FontWeight','b');
ylabel('\it{CI_{GPP}}','FontName', 'Calibri','FontSize',15,'FontWeight','b');
txt = strcat({'\it{R^2 = }'},'\rm',num2str(gof.rsquare,'%.2f'),',',...
' \it{p-val < }','\rm',num2str(0.05,'%.2f'));
lgd = legend(txt);
set(lgd,'FontSize',12);
lgd.Location = 'NorthWest';
hold off

我猜 Windows 有问题?因为我以前经常得到好的情节。提前谢谢..:)

编辑 1:我正在单击导出图标创建文件。 编辑2:尝试重新安装matlab,仍然得到相同的结果

编辑 3:最终的解决方案是我将字体更改为“Times New Roman”。现在数字输出是正确的..:)

【问题讨论】:

  • 您需要展示如何“保存”示例中显示的文件。
  • 感谢您的快速回复。我正在点击导出图标保存它。
  • 绝对是字体问题。导出图形的文件格式是什么?是位图格式,Windows 图元文件,EPS,...?
  • 好的,我会尽力让你知道的。我现在正在导出为 pdf 以在乳胶中使用它。有趣的是,当我单击文件窗口并将其打印为 pdf 时,打印效果很好。

标签: matlab matlab-figure


【解决方案1】:

为获得最佳效果,请始终使用 saveas 保存为 MATLAB 图形或使用 print 保存为图像。

figHandle=figure(...);
axes(...);
plot(...);
plot(...);

saveas(figHandle,filePath1);
print(figHandle,'-dpng','-r300',filePath2);

【讨论】:

  • 您好 Heriantolim,感谢您的输入,即使打印功能也给出了相同的结果。我对它的原因感到很困惑。我什至重新安装了 matlab,但得到了相同的结果。
  • 好的。还有一些建议。尝试将字体更改为无聊的字体,例如 Arial 或 Times New Roman。如果这不起作用,请尝试使用厘米单位并手动设置每个位置:set(objHandle,'Units','centimeters','Position',[...])
  • 感谢heriantolim!我将字体更改为 times new roman 并给出正确的数字..:) 但奇怪的是这应该发生..
猜你喜欢
  • 1970-01-01
  • 2017-07-26
  • 2014-12-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-15
相关资源
最近更新 更多