Antworten (1)

Thorsten
Thorsten am 5 Nov. 2015

0 Stimmen

x1 = 10; x2 = 20; y1 = 12; y2 = 34;
line([x1 x2],[y1,y2],'color','r','linestyle','--');
legend('my dashed red line')

2 Kommentare

Mr M.
Mr M. am 9 Nov. 2015
Bearbeitet: Mr M. am 9 Nov. 2015
Yes, but I want to use it in general. For example I have plot; plot; line; plot; hist; line; plot; bars; etc. And how to add legend to the lines?
Thorsten
Thorsten am 10 Nov. 2015
Bearbeitet: Thorsten am 10 Nov. 2015
h = line([x1 x2],[y1,y2],'color','r','linestyle','--');
legend(h, 'my dashed red line')
If this does not the job, please post a minimal working example of what you try to do and what goes wrong.

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 5 Nov. 2015

Bearbeitet:

am 10 Nov. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by