Regarding plot display issue

I am unable to view the plot after giving plot command. The figure window looks blank. I am attaching a snap of how it looks. Please help me with this.

8 件のコメント

Adam Danz
Adam Danz 2020 年 11 月 13 日
You're either 1) not specifying the axis handle and it's being plotted on another figure, 2) the axes are positioned outside of the visibile figure, 3) an error is stopping the execution of the plot.
dpb
dpb 2020 年 11 月 13 日
Add
clear
close all
figure
in front of above sequence of commands and report back.
Onkar Khadke
Onkar Khadke 2020 年 11 月 14 日
Thank you it worked.
dpb
dpb 2020 年 11 月 14 日
So, another figure/axis was active instead of the one you though/intended...
Onkar Khadke
Onkar Khadke 2020 年 11 月 14 日
Yeah,now it works well. Thank you for your response
Adam Danz
Adam Danz 2020 年 11 月 14 日
編集済み: Adam Danz 2020 年 11 月 14 日
Get in the habit of specifying the parent of graphics objects.
Examples:
fig = figure();
ax = axes(fig);
plot(ax, rand(1,10))
Onkar Khadke
Onkar Khadke 2020 年 11 月 14 日
Sure, I will make it a habit.
dpb
dpb 2020 年 11 月 14 日
What can happen to cause the symptom you saw before is, that without code between the time you created the figure you intended to plot into you may have looked at another figure manually. That user intervention would have changed the current axes from the figure so that the implicit handle in a plot() command without an explicit reference would use gca -- the one then being pointed at, not the figure that was created.
That's just one easy to visualize way that focus can change sorta' unexpectedly -- there are many other ways besides...hence the recommendation to always be safe when coding.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

リリース

R2020a

タグ

質問済み:

2020 年 11 月 13 日

コメント済み:

dpb
2020 年 11 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by