Why is my plot not showing anything?

I typed in the following into my MATLAB command window:
>> figure
>> hold on
>> axis([-5, 5, -5, 5])
>> plot(3,4)
However, nothing shows up in my graph. How can I fix this?

1 件のコメント

Stephen23
Stephen23 2018 年 2 月 4 日
plot(3,4)
plots one point with no marker: what do you expect to see?

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

 採用された回答

Star Strider
Star Strider 2018 年 2 月 4 日

4 投票

Try this:
figure
hold on
axis([-5, 5, -5, 5])
plot(3,4,'pg')
The default plot behaviour is to plot a line between successive points. When you give it only one point, it plots nothing unless you tell it to plot a marker, as I do here.

3 件のコメント

Alec Chirinos
Alec Chirinos 2019 年 3 月 5 日
I know that you where solving a simple question, but you did me a great favor.
Star Strider
Star Strider 2019 年 3 月 6 日
My pleasure.
Rachel Friedman
Rachel Friedman 2021 年 2 月 8 日
two years later but this helped me so much

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by