请帮忙。我想要的是在各自的图例中有一个标记(圆、正方形等)。
编辑1
这里提供的解决方案没有解决我的问题,因为它没有说明如何添加标记。动画演示了如何自定义标记的位置,但这里我想添加一个新标记,而不是重新定位原来的现有标记。
在这幅图像中,你可以看到3条线,实际上是6条线,其中一条线不可见,仅用于显示标记,另一条线是原始数据点的平滑版本。现在的问题是如何在Legend中获取标记。在这种情况下,您可以看到图形图例仅由线条组成,而不是由标记组成。我的代码如下。
clc; clear all ;
colour_green = [12 195 82] ./ 255;
colour_lightgreen = [94 250 81] ./ 255;
colour_lightblue = [8 180 238] ./ 255;
colour_darkblue = [1 17 181] ./ 255;
colour_peach = [251 111 66] ./ 255;
figure('DefaultAxesFontSize',30);
set(0,'DefaultAxesFontName',' Times ');
hold on
time_window = xlsread('pattern_data.xlsx', 'effect_of_count', 'A2:A12');
count1plus = xlsread('pattern_data.xlsx', 'effect_of_count', 'B2:B12');
count10plus = xlsread('pattern_data.xlsx', 'effect_of_count', 'C2:C12');
count1to5 = xlsread('pattern_data.xlsx', 'effect_of_count', 'D2:D12');
x1 = 50:1:99;
% x1 = .01:.01:.5;
x2 = interp1(time_window,count1plus,x1, 'pchip') ;
x3 = interp1(time_window,count10plus,x1, 'pchip') ;
x4 = interp1(time_window,count1to5,x1, 'pchip') ;
% count 1+
plot(x1,x2,'b--','DisplayName', 'Count_{A} = 1: and Count_{B} = 1:','LineWidth',3)
plot(time_window,count1plus,'bs', 'HandleVisibility','off','LineWidth',5)
% count 1:5
plot(x1,x4,'-','DisplayName', 'Count_{A} = 1: and Count_{B} = 5:','LineWidth',3 , 'Color', colour_green)
plot(time_window,count1to5,'^', 'HandleVisibility','off','LineWidth',5 , 'Color', colour_green)
% count 10+
plot(x1,x3,'r--','DisplayName', 'Count_{A} = 1: and Count_{B} = 10:','LineWidth',3)
plot(time_window,count10plus,'ro', 'HandleVisibility','off','LineWidth',5)
hold off
xlabel('Th_{B} ')
ylabel('L (milliseconds)')
legend('Location','north')
legend show
set(gcf, 'PaperUnits', 'normalized');
set(gcf, 'PaperPosition', [0 0 1 1]);
set(gcf,'PaperOrientation','l');
print -dpng graphs/p1_effect_of_count_and_selB;
请帮忙。我想要的是在各自的图例中有一个标记(圆、正方形等)。
编辑1
提供的解决方案here没有解决我的问题,因为它没有说明如何添加标记。动画演示了如何自定义标记的位置,但这里我想添加一个新的标记,而不是重新定位原来的现有标记。