Combining plots

조회 수: 2 (최근 30일)
Volkan Kandemir
Volkan Kandemir 2012년 4월 4일
Hi everyone.
I want to combine discontinious line as follows.
h1=plot([0 1],[0 1],'DisplayName','data1')
hold on
h2=plot([5 4],[6 7],'DisplayName','data1')
There will be two lines, one is from (0,0) to (1,1) and other one is from (5,6) to (4,7). Both lines are named as 'data1' but still they are independed of each other. On the Legent there are 2 series named as 'data1'.How to combine these two lines such that there will be only one series named as 'data1'.

채택된 답변

Honglei Chen
Honglei Chen 2012년 4월 4일
You can try the following trick and see if it addresses your need.
plot([0 1 nan 5 4],[0 1 nan 6 7],'DisplayName','data1')
legend('data1')
  댓글 수: 1
Volkan Kandemir
Volkan Kandemir 2012년 4월 4일
Thanks a lot it will be very helpfull

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation of 2-D Selections in 3-D Grids에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by