Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase figure width in a Matlab live script?

I'm using a Matlab Live script in which I'd like to use some subfigures. As the Standard figure size only uses a small section of the screen widths, I tried to enlarge the figure as follows:

h = figure;
subplot(1,2,1);
subplot(1,2,2);
set(h, 'Position', [0 0 1000 500])

This works entirely fine, for 'normal' figure Windows, but appearently not for in-line figures in live scripts.

As to be seen from the screenshots below, in the live script, the figure's size only increases to a small amount (fig. 1 -> fig. 2) and even decreases after a certain width (fig. 3).

Any ideas on how I can further increase the used pagewidth in the live script, or hints on what I'm doing wrong are appreciated.

Thanks

fig. 1

1

fig. 2

2

fig. 3

3

like image 585
Paolo Pantani Avatar asked Nov 26 '18 11:11

Paolo Pantani


1 Answers

An alternative approach that seems to work for me (R2020b) is to use normalized units when declaring the position:

h = figure();
subplot(1,2,1); 
subplot(1,2,2); 
set(h,'Units','normalized','Position',[0 0 1 .5]); 

The first two elements of the Position array tell MATLAB where to place the bottom-right corner (position (0,0)) whereas the last two elements determine the figure's X and Y size. The above snippet results in figures as large as the text, as seen here: image.

like image 76
jackphen Avatar answered Sep 18 '22 14:09

jackphen