Plot on top of semilogy plot
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello, thanks for reading this,
I want to make a plot on top of a semilogy plot. What I mean by this is the following:
I have a test row array:
B = [236715 13924 3292 2158 1450 971 977 1180 1117 360]
and I create a semilogy plot with the command:
semilogy(B, '*-')
Now, just for some look-pretty visualization, I want to add something on top of this: lines coming from each of the points down to the x axis. Using the major gridlines isn't what I mean, I mean plotting on top of this lines from each of the 10 points back down to the x axis (coloring will change depending on parameters).
I use the code listed here:
for i=1:10
hold on
line([i i],[B(i) 0], 'r')
end
to make the lines, but it doesn't show up. I can make hold on plots just using individual points, but any kind of traced line I try to create doesn't work. I tried using this code with the plot of B, instead of the semilogy plot, and it works, but the data doesn't look as good. Is there a way to trace on top of this?
Thanks!
댓글 수: 0
채택된 답변
Star Strider
2014년 7월 18일
Try the stem plot function:
B = [236715 13924 3292 2158 1450 971 977 1180 1117 360];
L = length(B);
figure(1)
semilogy(B, '*-')
hold on
stem(1:L, B, 'r')
hold off
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!