Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multiple cdf plot and change color

1,371 views
Skip to first unread message

Skirt Zhang

unread,
Jun 2, 2011, 9:21:05 AM6/2/11
to
Dear All,

I have a N*K matrix A and I want to get the cdf plot in one graph and change each colors. My code is below but I always get blue color for all.... Since I have more than 10 cdfs to plot it would be great if someone could help me with this in a loop method!!

THanks,

figure
ColorSet = varycolor(K);

set(gcf, 'Colormap', ColorSet );


k=[1:1:K];

for i=1:K
h(i)=cdfplot( betas(i,:) );

hold on
end

Steven_Lord

unread,
Jun 2, 2011, 9:40:10 AM6/2/11
to

"Skirt Zhang" <silenc...@hotmail.com> wrote in message
news:is82o1$qqc$1...@newscl01ah.mathworks.com...


> Dear All,
>
> I have a N*K matrix A and I want to get the cdf plot in one graph and
> change each colors. My code is below but I always get blue color for
> all.... Since I have more than 10 cdfs to plot it would be great if
> someone could help me with this in a loop method!!

Try "hold all" instead of "hold on".

http://www.mathworks.com/help/techdoc/ref/hold.html

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Grzegorz Knor

unread,
Jun 2, 2011, 9:49:05 AM6/2/11
to
"Skirt Zhang" <silenc...@hotmail.com> wrote in message <is82o1$qqc$1...@newscl01ah.mathworks.com>...

Use SET function to change color of each line:

clr = jet(10);
hold on
for k = 1:10
y = evrnd(0,k,100,1);
h(k) = cdfplot(y);
set(h(k),'Color',clr(k,:))
end

best regards
Grzegorz

0 new messages