首页 > 解决方案 > 在 Octave 的多线绘图标签中更改一行的字体大小

问题描述

是否可以使用 ylabel 命令更改多行绘图标签中一行文本的字体大小。如果有怎么办?

PS:我使用的是 Octave 5.2

我尝试了下面的代码,但它给了我一个错误。

figure
plot((1:10).^2)
ylabel_txt1=strcat('1st line of text with smaller font') %1st line
ylabel_txt2=strcat('2nd line of text') %2nd line
ylabel({(ylabel_txt1,'fontsize',13) ;ylabel_txt2})

标签: plotoctaveaxis-labels

解决方案


由于要求澄清,因此将我的评论扩展到答案。
希望代码是不言自明的:)

ylabel_txt1 = '1st line of text with smaller font'; % 1st line
ylabel_txt2 = '2nd line of text';                   % 2nd line

F   = figure()
Ax1 = axes()
Ax2 = axes()

% create Ax2, make everything invisible except for ylabel
axes( Ax2 )
set( Ax2, 'color', 'none', 'xcolor', 'none', 'ycolor', 'none' )
ylabel( {ylabel_txt2, ' ', ' ', ' '}, 'fontsize', 16, 'color', 'k' );

% now 'create' Ax1 on top of Ax2
axes( Ax1 )
plot( (1:10) .^ 2 )
ylabel( ylabel_txt1, 'fontsize', 13 );

推荐阅读