How can I name/ categorize columns in my legend?

1 次查看(过去 30 天)
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
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