Exporting figures as vector graphics in .pdf-format using HG2-Update and 'painters' renderer is not working properly

前端 未结 2 1854
梦谈多话
梦谈多话 2020-12-19 17:50

I\'m using the still undocumented HG2-Update to create my MATLAB plots, because they just look that much nicer.

2条回答
  •  我在风中等你
    2020-12-19 18:24

    I had the same problem and used the workaround from thewaywewalk. Now I discovered the MATLAB function "hgexport" works under HG2 (in R2014a).

    An issue still was the paper size. I want to use the same size for all graphs with as little white frame as possible. Here you have to set two sizes:

    The papersize is set with set(gcf,'PaperSize',[width height]) and the size of your chart is set through export styles. These are set in "Export Setup" or command line:

    exp_style=hgexport('readstyle','default');
    exp_style.Width = 'width';
    exp_style.Height = 'height';
    exp_style.Renderer = 'painters';
    

    Now you can export your pdf:

    hgexport(gcf,'pdfname',exp_style,'Format','pdf');
    

    PS: In HG2 you may also use Latex for tick labels:

    set(gca,'TickLabelInterpreter','latex');
    

提交回复
热议问题