-1

I'm trying to help my girlfriend make an animation for an experiment where basically this group of cells moves across a petri dish and there's a camera tracking their individual positions over time. The data collected is in the form of time intervals and the positions of specifics cells in the group at that time. In thinking of the 5 important values each tuple is in a form like (C,t,X,Y,Z) where C=cell number, t=time, and X,Y, and Z are position. The excel sheet of data has a couple hundred of these tuples for about 10 cells C={1,2,3,..,10} over 40 seconds.

I have seen macros in excel and MATLAB programs where you can graph a scatter plot in 3D space and be able to rotate it and stuff but I am wondering what work is involved in taking this a step farther and having some sort of animation where the points on the scatter plot shift as time increases. Like animate a 3D scatter plot so as a clock runs up to say 20 seconds the points shift as their values change.

Has anyone had experience doing something like this in a programming language or excel(although I assume it would be pretty nasty in VBA).

Mike Hawk
  • 77
  • 1
  • 1
  • 9

2 Answers2

0

Something that might get you going in MATLAB:

% generate some data to visualize
z = 0:pi/50:10*pi;
x = sin(z);
y = cos(z);

% split by cells
idx_C1 = 1:100;
idx_C2 = 101:200;

t_C1 = linspace(now-2,now-1,100);
t_C2 = linspace(now-1,now,100);

% plot as 3d scatter plot - distinguish cells by marker style
figure
p1 = scatter3(x(idx_C1),y(idx_C1),z(idx_C1),[],t_C1,'s','DisplayName','Cell 1');
hold on;
p2 = scatter3(x(idx_C2),y(idx_C2),z(idx_C2),[],t_C2,'o','DisplayName','Cell 2');

% color code the time value
hc = colorbar;
hc.TickLabels = string(datetime(hc.Ticks,'ConvertFrom','datenum'));

% show legend
legend('show','Location','northwest');

Keep in mind that visualization should always be done with the data at hand and you will need to work out what is best for your problem.

I chose to use the x,y,z coordinates as is and to color code the time variable. The different cells I plot with different markers. However, such 5D plots tends to be messy and confusing. I would likely go and create one figure for each cell instead of differentiating them with markers.

souty
  • 607
  • 3
  • 10
0

It sounds like you might already have code to plot the data a single time point in 3D (or that you feel comfortable enough to figure that part out on your own). If that is done/do-able then another approach would be to use a Matlab GUI with a slider bar that controls the time-point being plotted. The intended result would be an interactive window where whenever you adjust the slider bar, a plot is updated to show the cell positions in 3D at a time determined by the slider.

Alternatively, if you're looking for a non-interactive video that simply shows the movement over time as a demonstration (e.g. as a flashy visual for part of a presentation) there are methods for turning a series of plots into a video. Take a look at this tool posted to File Exchange.

JMikes
  • 572
  • 4
  • 12