legend repeating same color only after errorbar

조회 수: 2 (최근 30일)
Josef
Josef 2023년 8월 27일
편집: Voss 2023년 8월 27일
i have a figure that shows 6 diffrent values.
3 lines and 3 errorbars, when i use legend the color stuck after the errorbar.
if i change the order the color stays the same only for 5 times and dor the 6 is normal.
the code for this graph is included.
i think the problem is with the errorbar, the function somehow gives the point individual and not togeter.
  댓글 수: 1
Josef
Josef 2023년 8월 27일
I found the problem.
I gave the function "errorbar" a singal value for the y-error and a array of 5 values for the x-error, you must use the same length of array for them to count as a "singal line".

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

채택된 답변

Voss
Voss 2023년 8월 27일
편집: Voss 2023년 8월 27일
Each call to errorbar() creates multiple errorbar objects in this case. To use only one of each color in the legend, store their handles and specify in the call to legend() that only the first element of each shall be used. See the code attached.
Flow_meas_graph12

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Errorbars에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by