Plot on top of semilogy plot

4 visualizaciones (últimos 30 días)
Brian
Brian el 18 de Jul. de 2014
Respondida: Star Strider el 18 de Jul. de 2014
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!

Respuesta aceptada

Star Strider
Star Strider el 18 de Jul. de 2014
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

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by