Borrar filtros
Borrar filtros

How can I change the line type in a graph using plot?

22 visualizaciones (últimos 30 días)
Khade Grant
Khade Grant el 13 de Feb. de 2015
Respondida: Geoff Hayes el 13 de Feb. de 2015
My code so far is:
x = 0:10;
y = x.^2;
plot(x, y);
The graph shows up as a curved line. How do I change the line type to a dotted line or a dashed-dot line? Also, how do I remove the line (if I want to make a scatterplot)?

Respuestas (1)

Geoff Hayes
Geoff Hayes el 13 de Feb. de 2015
Khade - if you wish to use something other than a curved/connected line, then change your call to plot to
plot(x,y,'--');
which will create a dashed line. Use '-.' for a dashed-dot line.
See linespec for more options, and in particular the character specifiers which will help you create a scatter plot.

Categorías

Más información sobre Discrete Data Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by