How to change the font size of a plot's title and axis labels and save it?

前端 未结 3 1246
暗喜
暗喜 2021-01-24 14:33

Every time I save a plot picture as jpg or png, font size of title and axis label is changed back to default automatically. My code is like this:

figure
plot(x,          


        
3条回答
  •  感动是毒
    2021-01-24 15:12

    I found that "print" command can solve this problem.

    fig = figure;
    plot(x, f(x));
    title('the smallest n = 1', 'FontSize', 24);
    xlabel('x', 'FontSize', 24);
    ylabel('x''', 'FontSize', 24);
    print(fig, 'PicName', '-dpng');
    

    The third argument is to specify the format. In my case, I would like to save it to png file.

    The font size would remain the values I set now.

提交回复
热议问题