Matlab Shortcut Using Flat Feature

As shown in the attached screenshot, the EPS output from Matlab is to cut the label to the right of the Y axis.

I use the plotyy function, and print in eps with: print (f1, '- depsc2', 'figure1.eps');

I tried to change the paperposition property as well as the paperize property, and they seem to keep scaling with a different one at each setting, and so I can never increase the paper size on the right.

I installed paperpositionmode in the manual.

Does anyone have any ideas?

I have created some sample code, which in itself is sufficient and replicates the problem. The problem occurs when increasing the size of the tick and font. However, this is important for my situation.

close all; % example data: x = 0:0.01:4; y1 = 5*sin(2*pi*x+0.1) + 20; y2 = 0.09*sin(2*pi*x); tickfontsize = 18; labelfontsize = 20; % begin figure: f1 = figure(1); [ax, h1, h2 ] = plotyy(x,y1,x,y2) % axis labels and font size: set(get(ax(2),'Ylabel'),'String','Test1') ; set(get(ax(1),'Ylabel'),'String','test2') ; set(get(ax(1),'Ylabel'),'FontSize',labelfontsize) ; set(get(ax(2),'Ylabel'),'FontSize',labelfontsize) ; % left hand side ticks: set(ax(1),'YLim',[6 10]); set(ax(1),'YTick',[6:1:10]); set(ax(1),'FontSize',tickfontsize); % right hand side ticks: set(ax(2),'YLim',[-0.13 0.14]); set(ax(2),'YTick',[-0.1:0.05:0.1]); set(ax(2),'FontSize',tickfontsize); %print figure to eps: print(f1,'-depsc2', './simpleoutput.eps'); 

Screenshot of EPS output

+6
source share
1 answer

Reposition the axes to make them narrower:

 set(ax(1),'Position', [0.13 0.11 0.775-.08 0.815]); set(ax(2),'Position', [0.13 0.11 0.775-.08 0.815]); % Original position was [0.13 0.11 0.775 0.815] % Applied change in width: "-.08". Choose as desired 

If you need to keep the ratio of the axes, you must also change the height (fourth number).

+6
source

Source: https://habr.com/ru/post/954509/


All Articles