How to add lines in my plot?

조회 수: 9 (최근 30일)
Emmanouil - Nektarios Kalligeris
Hello. I have a plot and i want to display two lines ,one horizontal and one vertical ,so that both of them begin from 0. How can i do it?
My script:
plot(X(:,1),X(:,2),'ob',Y(:,1),Y(:,2),'or',0,0,'-k');
h = legend(wew3,wew4,2);
text(X(:,1)+.002,X(:,2)+.002,labels1,'Color',[0 0 1]);
text(Y(:,1)+.002,Y(:,2)+.002,labels2,'Color',[1 0 0]);
title('Plot');
xlabel(['1 ' num2str(1)';]);
ylabel(['2' num2str(2)';]);
Thank you

채택된 답변

CS Researcher
CS Researcher 2016년 5월 6일
Assuming the line length is L. You can do this:
line([0 0],[0 L]); hold on; line([0 L],[0 0]);
  댓글 수: 1
Emmanouil - Nektarios Kalligeris
Thank you very much for your help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by