This is my code:
p=.2;
x=-1:20;
px=p*(1-p).^(x-1).*(x>=1);
Fx=cumsum(px);
figure;
subplot(2,1,1);
stem(x,px);
subplot(2,1,2);
stairs(x,Fx);
hold on;
stem(x,Fx,'w.')
I want to draw a circle mark at the right end of each horizontal line on the second subplot. Could someone show me how to do? Thanks in advance~
Things like following figure, but move the circle to the right end of each line.
You can use plot
or scatter
to draw the red circles.
Add one of the following instructions at the end of your script, they give the same output.
% Option 1: using plot
plot(x+1,Fx,'or');
% Option 2: using scatter
scatter(x+1,Fx,'r');
As you can see, my approach was to simply add 1 to every element of x
. This is essentially shifting your data 1 unit in the x
direction.
This is what you get:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.