Change the color of the bar of histogram in Matlab -


i trying print histogram need values bigger specific value(250 example) in orange.

the output is: enter image description here

and need : enter image description here help, code:

    fh = figure;     hist(pz);     saveas(fh, strcat('figures\window), 'jpg')     close(fh); 

one way go using bar plot data, in case limited colors provides, are: 'b' | 'r' | 'g' | 'c' | 'm' | 'y' | 'k' | 'w'. here's sample code that:

%// generate data data = randn(2000,1); bins = -5:5; [n,x] = hist(data,bins); %% //color count limit_val = 500; figure(); bar(x,n,'b');hold on; bar(x,n.*(n<limit_val),'r'); hold off; %% //color bin position limit_val = 2; figure(); bar(x,n,'b');hold on; bar(x(abs(x)>=limit_val),n(abs(x)>=limit_val),'r'); hold off; 

another way modifying patch color mentioned @lakesh.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -