%% ============================================================ % PLOT % ============================================================ figure; hold on; ms = 32; % scatter size lw = 0.8; % line width for k = 1:4 % PAM-2/4/6/8 M = pam_list(k); idxPam = (Mvals == M); % Extract for this PAM x = baud(idxPam); y = netrate(idxPam); n = names(idxPam); % Get color for this PAM format col = colors(k,:); % ----- LEGEND FLAG (only add one entry per PAM) ----- firstLegend = true; % ---- PLOT ALL POINTS (marker based on publication) ---- for i = 1:sum(idxPam) % marker selection by publication pubIdx = find(pub_list == n(i), 1); marker = markerlist{mod(pubIdx-1, nMarkers) + 1}; if firstLegend h = scatter(x(i), y(i), ms, ... 'Marker', marker, ... 'MarkerEdgeColor', col, ... 'MarkerFaceColor', col, ... 'DisplayName', sprintf('PAM-%d', M)); firstLegend = false; else h = scatter(x(i), y(i), ms, ... 'Marker', marker, ... 'MarkerEdgeColor', col, ... 'MarkerFaceColor', col, ... 'HandleVisibility','off'); end % ====== CUSTOM DATATIP CONTENT ====== dt = h.DataTipTemplate; dt.DataTipRows(1).Label = 'Baud rate'; dt.DataTipRows(2).Label = 'Net rate'; % Add publication name dt.DataTipRows(end+1) = dataTipTextRow('Publication', n(i)); end % ---- Fit (PAM-specific) ---- valid = ~isnan(x) & ~isnan(y); if sum(valid) >= 3 p = polyfit(x(valid), y(valid), 2); xfit = linspace(min(x(valid)), max(x(valid)), 200); yfit = polyval(p, xfit); plot(xfit, yfit, ':', ... 'LineWidth', lw, ... 'Color', col, ... 'HandleVisibility', 'off'); % do NOT add to legend end end grid on; xlabel('Baud rate [GBd]'); ylabel('Net rate [Gb/s]'); legend('Location','northwest'); set(gca,'FontSize',11); %% === EXPORT === outfile = 'C:\Users\Silas\Documents\latex\JLT_400G copy\media\matlab2tikz\highspeedresults.tikz'; matlab2tikz(outfile, ... 'width','\fwidth', ... 'height','\fheight', ... 'showInfo',false, ... 'extraAxisOptions',{ ... 'legend style={font=\footnotesize}', ... 'legend columns=1' ... });