Question

I have the following step function: enter image description here

I wish to add 2 markers, on the left hand side of the horizontal line as a filled circle and on the right hand side a circle which is not filled with color. How can I do this please? Thank you.

I used very simple code for this graph. The code is:

x=[1 1.5];
y=[1 1];
plot(x,y)
hold on
x=[1.5 2.6];
y=[2 2];
plot(x, y)
hold on
x=[2.6 5];
y=[3 3];
plot(x, y)
hold on
x=[5 6];
y=[4 4];
plot(x, y)
hold on
x=[6 6.5];
y=[5 5];
plot(x, y)
hold on
x=[6.5 8];
y=[6 6];
plot(x, y)
axis([0 9 0 7])
Was it helpful?

Solution

Do as follows for each segment (the new lines are the last two):

x=[1 1.5];
y=[1 1];
plot(x,y)
hold on
plot(x(1),y(1),'o','MarkerFaceColor','b') %// filled circle
plot(x(2),y(2),'o') %// non-filled circle

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top