Currently, I am using the figure editor to fine tune this, but I could implement a solution easily enough in script as well.
Hi Camron,
A while ago I did something like this and found some example code in the
MATLAB doc (under "Controlling Legends"). Here's my code:
%% Create dummy data
SNRs = 0:1:25;
dummy_data = [10.^(-SNRs); 5.^(-SNRs); 20.^(-SNRs)];
%% Plot theoretical curves
h_lines = semilogy(SNRs,dummy_data,':');
hold on
%% Plot simulation results
simLines = semilogy(SNRs, dummy_data,'*');
%% Add Legend
% Do MATLAB graphics magic to create concise legend
% See "Controling Legends" in MATLAB doc
% group lines together
simGrp = hggroup('DisplayName','Simulation');
theoGrp = hggroup('DisplayName','Theoretical');
set(simLines,'Parent',simGrp)
set(h_lines,'Parent',theoGrp)
set(get(get(simGrp,'Annotation'),'LegendInformation'),...
'IconDisplayStyle','on'); % Include this hggroup in the legend
set(get(get(theoGrp,'Annotation'),'LegendInformation'),...
'IconDisplayStyle','on'); % Include this hggroup in the legend
legend show
HTH,
Idin
--
Idin Motedayen-Aval
The MathWorks, Inc.
zq=[4 2 5 -15 -1 -3 24 -57 45 -12 19 -12 15 -8 3 -7 8 -69 53 12 -2];
char(filter(1,[1,-1],[105 zq])), clear zq