how to plot staggered array?

I want to plot an array with each successive row ("trace") offset slightly to create a staggered array of the data, such as:
How can I eliminate the blank values (i.e. y=0) that are creating those straight lines to the left of each successive trace?
Here is my code (the original data array is named "dF_F"; the number of successive traces is named "cell_num"; the length of each trace is named "scan_num"):
clc;
x_offset=3;
y_offset=1;
a=size(dF_F);
cell_num=a(1,1);
scan_num=a(1,2);
stagger=[cell_num,(x_offset*(cell_num-1)+scan_num)];
fig = gcf;
ax = axes('Parent', fig);
for i=1:(cell_num)
stagger(i,(x_offset*i-1):(x_offset*i-1)+(scan_num-1))=dF_F(i,:);
stagger(i,:)=stagger(i,:)+i;
graph=[stagger(i,:)];
plot(ax, graph,'k');
hold(ax, 'on');
end

Antworten (3)

Star Strider
Star Strider am 16 Okt. 2016

0 Stimmen

There are probably several ways to plot that. I would use the ribbon function, and then experiment with its options to get the result you want.

5 Kommentare

Stephen
Stephen am 16 Okt. 2016
Thanks, Star Strider! Being a newbie (probably obvious from the script!), I am(was) unaware of "ribbon". I will investigate.
Star Strider
Star Strider am 16 Okt. 2016
My pleasure!
With respect to the x-axis direction, see if:
set(gca, 'XDir','reverse')
does what you want.
Stephen
Stephen am 17 Okt. 2016
Thanks again, Star Strider.
Star Strider
Star Strider am 17 Okt. 2016
My pleasure.
As for defining the orientation of the plot, you can set that in your script with the view function. You can rotate the plot in the plot window by clicking on the cube with the anti-clockwise arrow around it on the toolstrip at the the top of the plot figure window. The azimuth and elevation will be displayed in the lower left of the plot figure window. You can manually enter those values as arguments to the view function when you have the view you want.

Melden Sie sich an, um zu kommentieren.

Stephen
Stephen am 16 Okt. 2016

0 Stimmen

OK, after flailing around with "ribbon" most of the day, I'm not sure that this function suits all my needs. I still need some help from a MatLab aficionado. Among other things, I can't seem to control the distance between traces, which I need to do. Or the "perspective". Ribbon assigns a displacement of "1" unit. Thus, the figure that I get with "ribbon" at best looks like:
(Yes, I see the traces are reversed from my original...I suppose I can somehow fix that).
I need something that looks more like the fig in my original question, above, but with the leading blanks on the ascending traces suppressed.
Any other ideas out there?

1 Kommentar

Stephen
Stephen am 16 Okt. 2016
Maybe I wrote too soon. I just discovered "rotate3d on". This helps. As did changing the z axis. I can now get:
This is much closer. Now to deal with the reversed traces (x axis is reversed)...

Melden Sie sich an, um zu kommentieren.

Image Analyst
Image Analyst am 17 Okt. 2016

0 Stimmen

Looks like an output from the waterfall() function. Is waterfall() the function you're looking for?

1 Kommentar

Stephen
Stephen am 17 Okt. 2016
Aha! A new function for me to explore. Thanks for the tip, Image Analyst.

Melden Sie sich an, um zu kommentieren.

Produkte

Gefragt:

am 16 Okt. 2016

Kommentiert:

am 17 Okt. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by