My goal: plot a horizontal line with a square bracket (---]
) end to it.
I usually plot horizontal lines with
line([0,1],[2,2],'linestyle',':')
I can add usual markers at the end by
plot([0,1],[2,2],'o')
but not square bracket.
Any suggestions?
Here's a terrible hack that kinda achieves what you want:
XVALS = [0,1; 0,2; 0,3].';
YVALS = [3 3; 2,2; 1,1].';
INVIZ_OFFSET = 0.04;
figure();
% Step 1: Plot squares:
plot(XVALS(2,:), YVALS(2,:),'bs');
% Step 2: Plot invisible squares:
hold on;
plot(XVALS(2,:)-INVIZ_OFFSET, YVALS(2,:),'ws','MarkerFaceColor','w');
% Step 3: Plot lines
plot(XVALS, YVALS,':b');
% Play with limits:
axis image; xlim([0,5]); ylim([0,4]);
Result:
The idea is that a "bracket" marker can be obtained using an obscured square marker. Obviously this isn't suitable for all plots, but I think you can work from here...