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 comentario

plot(3,4)
plots one point with no marker: what do you expect to see?

Iniciar sesión para comentar.

 Respuesta aceptada

Star Strider
Star Strider el 4 de Feb. de 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 comentarios

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 4 de Feb. de 2018

Comentada:

el 8 de Feb. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by