我的情节中的图例太长,如何将其分成两行?我正在使用 plotyy
进行绘图并使用以下代码:
leg = sprintf('I_{fitting}=I_0/(\surd{2\pi}\sigma)e^{-[t-t_0]^2/(2.\sigma^2)};\nso t_0=0.2\mus;\sigma=0.09\mus;I_0=4.8\cdot10^{10}W/cm^2')
legend([h1 h2], 'I=10^{14}[T_e/(3680(1.054)^{1/3})]^{1.5}',leg);
你能告诉我问题是什么吗?
最佳答案
试试这个
>> leg = sprintf('This is a really long line\nso I broke it in two')
>> plot(1:10, 1:10)
>> legend(leg)
结果
如果图例中有其他字符需要转义(例如,如果有大量 LaTeX),则此方法将不起作用。在这种情况下,您可以手动插入换行符 -
>> newline = char(10);
>> leg = ['This is the first line', newline, 'and the second: A = 2\pi r^2'];
>> plot(1:10, 1:10);
>> legend(leg)
结果
关于matlab - 使用plotyy 打破Matlab 图例中的长文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21887806/