我的代碼如下所示:加入傳奇
p = imread('C.png');
p1 = im2double(p);
RG = insertShape(p1, 'Filledcircle', pos1, 'LineWidth', 10,'Color','blue','Opacity',1);
RG = insertShape(RG, 'Line', {line1,line2},'Color',{0 1 0;0 1 1});
hc = imshow(RG);
legend(hc,'line1','line2');
legend('show');
我把我的X和Y從我一直在使用圖片瀏覽器應用程序插入圓座標,是不正確的方法來獲得座標以將它們融合在一起。
我不確定,但我覺得'legend'只能和'plot','scatter'等一起使用。試着用['annotation'](http:// www。 mathworks.com/help/matlab/ref/annotation.html)作爲'legend'的替代! –
換句話說,'legend'可能需要一個'axes'對象來關聯。 – EBH