The type of plot you are trying to make may be difficult to visualize well. I can give you two suggestions: one is what you want, and one is what you should probably do instead...
Plotting 4-D data:
In order to do this, you will have to plot a series of x,y,t
points and somehow represent the error value e
at each point. You could do this by changing the color or size of the point. In this example, I'll plot a sphere at each point with a diameter that varies based on the error (a diameter of 1 equates to the maximum expected error). The color represents the time. I'll be using the sample data you added to the question (formatted as a 5-by-4 matrix with the columns containing the x
, y
, t
, and e
data):
data = [4 5 2 45; 4 5 6 54; 7 8 2 32; 7 8 9 98; 7 8 1 121];
[x,y,z] = sphere; %# Coordinate data for sphere
MAX_ERROR = 121; %# Maximum expected error
for i = 1:size(data,1)
c = 0.5*data(i,4)/MAX_ERROR; %# Scale factor for sphere
X = x.*c+data(i,1); %# New X coordinates for sphere
Y = y.*c+data(i,2); %# New Y coordinates for sphere
Z = z.*c+data(i,3); %# New Z coordinates for sphere
surface(X,Y,Z,'EdgeColor','none'); %# Plot sphere
hold on
end
grid on
axis equal
view(-27,16);
xlabel('x');
ylabel('y');
zlabel('t');
And here's what it would look like:
The problem: Although the plot looks kind of interesting, it's not very intuitive. Also, plotting lots of points in this way will get cluttered and it will be hard to see them all well.
More intuitive 3-D plot:
It may be better to instead make a 3-D plot of the data, since it may be easier to interpret. Here, the x-axis represents the iteration number and the y-axis represents each individual network:
plot3(1:2,[1 1],[2 45; 6 54]); %# Plot data for network 4-5
hold on
plot3(1:3,[2 2 2],[2 32; 9 98; 1 121]); %# Plot data for network 7-8
xlabel('iteration number');
set(gca,'YTick',[1 2],'YTickLabel',{'network 4-5','network 7-8'})
grid on
legend('time','error')
view(-18,30)
This produces a much clearer plot: