【问题标题】:Changing Axis parameters Font to Arial in MATLAB在 MATLAB 中将轴参数字体更改为 Arial
【发布时间】:2016-08-05 12:22:35
【问题描述】:

我需要将轴参数的字体更改为 Arial。需要对代码进行哪些修改?我已经在 Arial 字体中定义了我的轴参数,但它不起作用?谢谢

newfigure = h_figure; 
%  fsize=[0 0 9 7]*1.394;  % Genesys
fsize=[0 0 9 7]*1.394;  % Framemaker

set(newfigure,'PaperUnits','centimeters');
% Festlegen der Dimensionen in cm der gesamten Grafik + Ueberschrift
set(newfigure,'PaperPosition',fsize); 
set(newfigure,'Position',fsize*254/6.1); 
figure(h_figure);
ax1=axes('Position',[0 0 1 1],'Visible','off');

% copy the axes into the new figure
%newaxes = copyobj(handles.axes2,newfigure);
%set(ax1,'Position',[0.1475 0.11 0.7688 0.841],'FontSize',[10],'GridLineStyle','-');
set(ax1,'Position',[0.5 0.11 0.7688 0.5],'FontSize',[20],'FontName','Arial','GridLineStyle','-','MinorGridLineStyle','-'); % Ra. 5.7.13
% print the new figure

%pos=0;
  pos=findstr(image_name, 'color'); % für farbige Plots!
  if isempty(pos)
      %print(newfigure,'-deps','-tiff',image_name);
      print(newfigure,'-dsvg',image_name);  %--------------------------------------------------------------------------------------------------------------- NEW MODIFICATION
  else
      print(newfigure,'-depsc','-tiff',image_name);    
  end

% save smithchart
savefiguresmith_cmd_ext(handles)
%print(newfigure,'-deps','-tiff',filename);
% close the new figure
%close(newfigure)

【问题讨论】:

  • 尝试更改父 figure 而不是 axes 的属性。
  • 什么操作系统和MATLAB版本?
  • Matlab 2015 版和32位Windows 7操作系统
  • @WasimAkhtar 如果您将其保存为 PNG 而不是矢量图形,字体是否正确?

标签: matlab matlab-figure


【解决方案1】:

我想我发现了问题:
对于要更新的​​字体,您应该在设置字体后执行drawnow 或pause 函数。

参见以下代码示例:

figure;
ax1 = gca;
plot(-pi:0.1:pi, sin(-pi:0.1:pi), 'Parent', ax1);
for i = 1:10
    set(ax1, 'FontSize',20,'FontName','Arial')
    drawnow
    pause(0.5);
    set(ax1, 'FontSize',20,'FontName','Courier New')
    drawnow
    pause(0.5);
end

【讨论】:

    猜你喜欢
    • 2020-12-15
    • 1970-01-01
    • 1970-01-01
    • 2018-08-19
    • 1970-01-01
    • 1970-01-01
    • 2012-02-14
    • 2012-10-14
    • 1970-01-01
    相关资源
    最近更新 更多