How can I name/ categorize columns in my legend?

조회 수: 1 (최근 30일)
Veerle Kohlen
Veerle Kohlen 2021년 3월 2일
답변: Keerthana Chiruvolu 2021년 3월 10일
I am plotting temperature against time in two conditions (wind and no wind). In total I have 3 different thermometers, therefore the plot will contain three lines for the no wind condition, and 3 lines for the wind condtion. I want to customize my legend so that it appears like this:
No wind: (line) TCosinuss, (line) Tty, (line)TFastFocus (line)
Wind: (line) TCosinuss, (line) Tty, (line)TFastFocus (line)
This is what I have so far:
hlegend = legend([nw_Cosinuss nw_Tympanic nw_Fastfocus w_Cosinuss w_Tympanic w_Fastfocus], 'T_C_o_s_i_n_u_s_s No Wind', 'T_t_y No Wind', 'T_F_a_s_t_F_o_c_u_s No Wind', 'T_C_o_s_i_n_u_s_s Wind', 'T_t_y Wind', 'T_F_a_s_t_F_o_c_u_s Wind', 'Location', 'SouthOutside', 'Orientation', 'Horizontal', 'FontSize', 15);
hlegend.NumColumns = 3

답변 (1개)

Keerthana Chiruvolu
Keerthana Chiruvolu 2021년 3월 10일
Hi Veerle,
Please try using the Categorial Arrays as your variables. For more information, see this.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by