필터 지우기
필터 지우기

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

조회 수: 22 (최근 30일)
Khade Grant
Khade Grant 2015년 2월 13일
답변: Geoff Hayes 2015년 2월 13일
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)?

답변 (1개)

Geoff Hayes
Geoff Hayes 2015년 2월 13일
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.

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by