How do I create a plot without displaying it?

14 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2019 年 7 月 5 日
回答済み: MathWorks Support Team 2019 年 7 月 5 日
I want to return a plot object to perform further work on it, so I am using "plot" with a return argument:
>> myPlot = plot( rand(5) );
However, this command also opens a figure with an axes and the plot is displayed inside the axes.
I would rather not open a figure or display the plot just yet.
How do I create a plot without displaying it?

採用された回答

MathWorks Support Team
MathWorks Support Team 2019 年 7 月 5 日
To return a graphic object without displaying it on screen, you can put it in a non-visible figure. For example:
>> myGhostFigure = figure("Visible",false)
>> myOrdinaryPlot = plot(rand(5))
The same concept applies to other graphic objects. For example:
>> myGhostFigure = figure("Visible",false)
>> myOrdinaryHistogram = histogram(rand(1000,1), 20)
If eventually you want to display the plot, you can simply make the figure visible:
>> myGhostFigure.Visible = true

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

タグ

タグが未入力です。

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by