How to add lines in my plot?

63 views (last 30 days)
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:
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]);
xlabel(['1 ' num2str(1)';]);
ylabel(['2' num2str(2)';]);
Thank you

Accepted Answer

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

Sign in to comment.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!

Translated by