trying to create a legend that explains scatter plot marker type
显示 更早的评论
The code below plots the minimum overturning circulation value of the Atlantic Thermohaline Circulation from 24 different simulations as a scatter plot figure, where simulations with the same total emissions are grouped together by colour, but each run is given a different symbol. For example the 'FAST' run from each cumulative emission group is given a '*' symbol, while the instantaneous pulse ('PULSE') runs are given a 'd' (diamond) symbol.
I am trying to create a legend that will explain the symbols used, not the colours used. The legend command gets the first four symbols correct (FAST, VFAST, OVST, and PULSE), but fails to give the correct symbols for MEDIUM and SLOW
(and I think I know why - because the first scatter plot group under h11 only has 4 symbols, so it moves onto the next 2 symbols from h12, which happen to be '*' and 'x', not 'x' and 's'). Does anyone know how to fix the legend, such that it will display the following:
'* FAST 'o' VFAST 'x' MEDIUM 's' SLOW '+' OVST 'd' PULSE
in this particular order?
subplot(2,2,3)
h11 = scatter(MOCmaxCumEmFAST, minMOCFAST,size,clr1,'*');
hold on
scatter(MOCmaxCumEmVFAST, minMOCVFAST,size,clr1,'o');
scatter(MOCmaxCumEmOVST, minMOCOVST,size,clr1,'+');
scatter(MOCmaxCumEmPULSE, minMOCPULSE,size,clr1,'d');
h12 = scatter(MOCmaxCumEmFAST2000, minMOCFAST2000,size,clr2,'*');
scatter(MOCmaxCumEmMEDIUM2000, minMOCMEDIUM2000,size,clr2,'x');
scatter(MOCmaxCumEmSLOW2000, minMOCSLOW2000,size,clr2,'square');
scatter(MOCmaxCumEmOVST2000, minMOCOVST2000,size,clr2,'+');
scatter(MOCmaxCumEmPULSE2000, minMOCPULSE2000,size,clr2,'d');
h13 = scatter(MOCmaxCumEmFAST3000, minMOCFAST3000,size,clr3,'*');
scatter(MOCmaxCumEmMEDIUM3000, minMOCMEDIUM3000,size,clr3,'x');
scatter(MOCmaxCumEmSLOW3000, minMOCSLOW3000,size,clr3,'square');
scatter(MOCmaxCumEmOVST3000, minMOCOVST3000,size,clr3,'+');
scatter(MOCmaxCumEmPULSE3000, minMOCPULSE3000,size,clr3,'d');
h14 = scatter(MOCmaxCumEmFAST4000, minMOCFAST4000,size,clr4,'*');
scatter(MOCmaxCumEmMEDIUM4000, minMOCMEDIUM4000,size,clr4,'x');
scatter(MOCmaxCumEmSLOW4000, minMOCSLOW4000,size,clr4,'square');
scatter(MOCmaxCumEmOVST4000, minMOCOVST4000,size,clr4,'+');
scatter(MOCmaxCumEmPULSE4000, minMOCPULSE4000,size,clr4,'d');
h15 = scatter(MOCmaxCumEmFAST5000, minMOCFAST5000,size,clr5,'*');
scatter(MOCmaxCumEmMEDIUM5000, minMOCMEDIUM5000,size,clr5,'x');
scatter(MOCmaxCumEmSLOW5000, minMOCSLOW5000,size,clr5,'square');
scatter(MOCmaxCumEmOVST5000, minMOCOVST5000,size,clr5,'+');
scatter(MOCmaxCumEmPULSE5000, minMOCPULSE5000,size,clr5,'d');
%title('Peak Response of Maximum Overturning Circulation for the 1000-5000 Gt C scenarios')
set(gca,'FontSize',15,'fontWeight','bold')
set(findall(gcf,'type','text'),'FontSize',15,'fontWeight','bold')
text(500,13.5,'C','FontSize',15,'fontWeight','bold')
xlabel('Cumulative Emissions at time of Peak MOC Response (GtC)')
ylabel('Minimum Overturning (Sv)')
axis([0 6000 12 20])
legend(['*' 'o' '+' 'd' 'x' 'square'],{'FAST', 'VFAST','OVST', 'PULSE','MEDIUM', 'SLOW'});
1 个评论
Jon Camilleri
2015-11-25
Where do I find parameter documentation in detail as I struggle to understand the examples given in the documentation?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!