Problems creating stacked plots on MATLAB

I would like to make a stacked plot of 3 y-axis variables, with variable 'time' on the x-axis. I have looked at the help function for stacked plot but I don't understand it. Do I need to create a table before making the stacked plot? I tried
The variables that I want on the y-axis are:
spiketimes : 1 x 100 double (it's a vector of times). I would like this to be as a raster plot.
transmit_times: 1 x 92 double (it's a vector of times). I would like this to be as a raster plot.
Probability: 1 X 10001 double. I would like a normal line graph for this
On the x-axis:
Time: 1 x 10001 double.

댓글 수: 6

What do you mean by "raster plot", precisely?
You can plot your long time vector and the probablilty that goes with it easily enough...
figure
plot(T,P)
hold on
% now the others...
The problem there is it isn't at all clear what you expect to do with the two shorter vectors of other time data...you can certainly plot at whatever time points you have on the same axis, but just what is it to be plotted against those times--we seem to be out of data.
Temi O
Temi O 2019년 3월 5일
Thanks. By raster plot, I mean something like I have below. I'm not sure I can use the hold on function because the quantities being measured on the y-axis are different. There's a stackedplot function on MATLAB but can't figure out what to do from the help.
Question 2.6 graph.jpg
dpb
dpb 2019년 3월 5일
편집: dpb 2019년 3월 5일
That's just a scatter() plot with a constant value of unity at the time points. There's no need for stacked plot; by a "stacked" plot I think of area, nothing like this.
Of course you can use hold on; this type of thing is precisely what it's there for...add more stuff to the plot besides just the initial line.
Now if you're trying to plot totally disparate ranges of y values on the axis, then "Yes, Virginia, we may have a problem!" but there what you're looking for is probably two y axes. See
doc yyaxis
for details and examples.
Temi O
Temi O 2019년 3월 7일
Thanks. I ended up using the subplot function.
dpb
dpb 2019년 3월 7일
Well, "if you're ok, I'm ok!" but if you would show just what you are trying to plot with some sample data if the subplot() isn't exactly what you had in mind, it's probably not difficult to do something much more like what you envisioned originally.
Temi O
Temi O 2019년 3월 7일
편집: Temi O 2019년 3월 7일
The subplot works. I created a subplot of 5 x 1 layout to get something like this
Q4.4ai.jpg

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

태그

질문:

2019년 3월 5일

답변:

2019년 3월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by