Setting figure size in Livescript (globally)

How can i set the size of a figure in a Matlab-Livescript? I didn't find any documentation or forum-posts on that topic but looking at the .pdf-Files that are output by the .pdf-exporter shows figure sizes that are nowhere near acceptable.
Included images are scalable by using mouse handles. I get, that that's not possible with plots, but setting the width (height would be adjusted), ideally globally throughout the document would be a real benefit

回答 (3 件)

Owen Paul
Owen Paul 2019 年 11 月 20 日

2 投票

Hi Tim,
Just ran into this issue myself and I was able to edit the figure's position property to decrease the size which also results in a decreased size when saving as a PDF. To do this you will need a handle for the plot's grandparent (I guess that would be the name). This doesn't deal with the global issue but it is a quick fix.
p = scatter(dat.RatedHP,dat.MPG);
k = p.Parent;
k.Parent.Position = [360 198 400 300]; % this size worked for me
[360 198 560 420] is the default position for reference.

2 件のコメント

Bill Tubbs
Bill Tubbs 2020 年 7 月 5 日
Also, if the plot is still current, you can simply so this:
set(gcf,'position',[0,0,400,250]);
This seemed to work for me.
wu lei
wu lei 2021 年 8 月 24 日
感谢你的帮助,我的问题得到解决。

サインインしてコメントする。

Shirin Madarshahian
Shirin Madarshahian 2020 年 9 月 18 日

2 投票

Hi Tim,
If you change the figure properties, the figure size will be ok in your live editor. So for exaplme wherever you ploted something go and set the figure as below:
figure('Renderer', 'painters', 'Position', [10 10 900 600])
This will make your plot in paper size and then when you save it as pdf or word file it will be ok.
Shirin M

2 件のコメント

Cory Dinkle
Cory Dinkle 2022 年 1 月 25 日
Extremely helpful, thank you.
Gary Clayman
Gary Clayman 2022 年 10 月 7 日
Very helpful! Thanks!

サインインしてコメントする。

Mariusz Wilk
Mariusz Wilk 2019 年 6 月 13 日

0 投票

I had a similar problem. I had this problem when I tried to export my Live script by pressing Ctrl+P. The figures were oversized. It can be solved by clicking on the Export to PDF button in the Live Editor Tab, under Save.
I don't know if it helps. Maybe you've already tried it.
M

カテゴリ

ヘルプ センター および File ExchangePrinting and Saving についてさらに検索

製品

リリース

R2019a

質問済み:

2019 年 5 月 11 日

コメント済み:

2022 年 10 月 7 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by