Plotting three histograms as a curved line on the same graph

1 view (last 30 days)
I have three large 200,000*1 vectors (z1,z2 and z3) with contains data and I am looking to plot all three as a histogram (but I would like a curved line which can be jagged) on the same graph. I have looked through the website and I altered a code that was used in another answer:
>> x=-10:0.01:10;
[n1, xout1] = hist(z1,x);
bar(xout1,n1,'r'); grid; hold
[n2, xout2] = hist(z2,x);
bar(xout2,n2,'g'); grid; hold
[n3, xout3] = hist(z3,x);
bar(xout3,n3,'g')
The problem was that the graph histograms are solid colours so I cannot see past the histogram that overlaps the other two histograms. I don't mind having slightly jagged edges on my curve, I don't expect it to be perfectly 'smooth'. Does anyone know how I can make my graphs 'transparent'?

Accepted Answer

John Petersen
John Petersen on 10 Jul 2012
Edited: John Petersen on 10 Jul 2012
plot(xout1,n1,xout2,n2,xout3,n3);
For transparent hist
h=findobj(gca,'Type','patch');
set(h,'FaceColor','white');

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!