Why is my plot not showing anything?

3 views (last 30 days)
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 Comment
Stephen23
Stephen23 on 4 Feb 2018
plot(3,4)
plots one point with no marker: what do you expect to see?

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 4 Feb 2018
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 Comments
Rachel Friedman
Rachel Friedman on 8 Feb 2021
two years later but this helped me so much

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!