overlayCenterDots
Version 1.0.2 (16,4 KB) von
Kazuki Matsumoto
This function takes a set of plot objects (subset) and a list of target indices (targetIdx). It overlays black dots on the original axes
This function takes a set of plot objects (subset) and a list of target indices (targetIdx). It overlays black dots on the original axes and legend.
figure;
x = 1:10;
hold on;
h1 = plot(x, x, "k-", MarkerFaceColor="w");
h2 = plot(x, 2*x, "k--", MarkerFaceColor="w");
h3 = plot(x, x+0.5*randn(size(x)), "ko", MarkerFaceColor="w");
h4 = plot(x, 2*x+0.5*randn(size(x)), "k^", MarkerFaceColor="w");
xlabel("x-axis");
ylabel("y-axis");
subset = [ h1 h2 h3 h4 ]; % objects displayed in legend
label = ["h1", "h2", "h3", "h4"]; % labels for objects
targetIdx = [3 4]; % target for adding dots
% Create legend and overlay center dots specifying the same subset
legend (subset, label, Location="northwest");
overlayCenterDots(subset, targetIdx);
exportgraphics(gcf, "example.png"); % export
Zitieren als
Kazuki Matsumoto (2024). overlayCenterDots (https://www.mathworks.com/matlabcentral/fileexchange/170111-overlaycenterdots), MATLAB Central File Exchange. Abgerufen .
Kompatibilität der MATLAB-Version
Erstellt mit
R2024b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.0.2 | Set XScale and YScale |
||
1.0.1 | Update example |
||
1.0.0 |