Problems in using the function: line()
이전 댓글 표시
I am trying to connect the points of a scatter plot with a line using line(x,y) but the line simply doesn't appear. The vectors are both of the same size. The first one is a linspace vector with 96 elements and the second is a vector with 96 elements obtained from calculations carried on in the main script. How do I connect the points that I obtained from a scatter plot of these two vectors?
답변 (1개)
Ameer Hamza
2018년 5월 24일
편집: Ameer Hamza
2018년 5월 24일
Use this code as a template
x = linspace(0, 100, 100);
y = rand(size(x));
scatter(x, y);
hold on;
line(x, y);
The scatter plot points will be connected.

댓글 수: 3
Luca Guarino
2018년 5월 24일
Stephen23
2018년 5월 24일
@Luca Guarino: please show us the exact code that you are using.
Luca Guarino
2018년 5월 24일
카테고리
도움말 센터 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!