Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Plotting errorbars of multiple datasets- Please help

Status
Not open for further replies.

intiha

Computer
Joined
Dec 1, 2004
Messages
1
Location
US
Hello everyone
I have been trying to plot multiple data sets (actually mean of 1000 simulation results) and their standard deviations on the same graph for some time now. However I havent been able to find a decent way of doing this. Currently I know i can plot:
1) multiple datasets using the plot(X1,mean(Y1),'b*',X2,mean(Y2),'r+-'.....) scheme or
2) plot a single dataset's mean and stdDev using errorbar(X1, mean(Y1),std(Y1)).
but i cant plot two the sets together! (I also want to give different color and legend names to each of them).

Can any body give me the best way to do this?



 
Hi,
Arrange, for example, your data sets in cell array.
Create a cell array of color spec:
Col={'k' 'b' 'c' 'r' 'y' 'm'}
Then loop:

for n =1:N
errorbar(X{n},Y{n},e{n},Col{n});
hold on
end
legend('series 1','series2;,'series 3', ...)


Joe Sababa

BSTeX - Equation viewer for Matlab

Joe
BSTeX- Equation viewer for Matlab
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top