Skip to content

Commit 5c0891f

Browse files
authored
Merge pull request #2 from MATLAB-Graphics-and-App-Building/Readme_Images
Fix legend bug and update examples
2 parents 89cf4e6 + f1d5c36 commit 5c0891f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
Examples.asv

Examples.mlx

53.4 KB
Binary file not shown.

deltaplot.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,15 @@ function setup(obj)
296296
% Create the axes
297297
ax = getAxes(obj);
298298
box(ax,'on');
299+
300+
% Turn legend on and place it outside to the right
301+
obj.LegendVisible = 'on';
302+
ax.Legend.Layout.Tile = 'east';
303+
304+
% Create patch and indicate it should not appear in legend
299305
obj.PatchHandle = patch(ax, 'XData',NaN,'YData',NaN, 'FaceVertexCData',NaN,...
300306
'EdgeColor','interp','MarkerFaceColor','flat');
307+
obj.PatchHandle.Annotation.LegendInformation.IconDisplayStyle='off';
301308

302309
% trigger colororder setter to compute colormap
303310
colors = get(groot,'DefaultAxesColorOrder');
@@ -310,8 +317,8 @@ function setup(obj)
310317
hold(ax,'on')
311318
obj.Stem1 = stem(ax,NaN, NaN, "filled");
312319
obj.Stem2 = stem(ax,NaN, NaN, "filled");
313-
l=legend(ax,[obj.Stem1 obj.Stem2]);
314-
l.Layout.Tile = 'east';
320+
321+
ax.Legend.Layout.Tile = 'east';
315322

316323
% Call the load method in case of loading from a fig file
317324
loadstate(obj);

0 commit comments

Comments
 (0)