# Plot and Histogram together in Mathematica 7

I want to draw a histogram and some line plots together. I have one observed variable and several predicted ones. Observed data should be shown as a histogram and the predicted variables should be shown as line plots or smooth histograms. I use Mathematica 7. Please help me to show which fitted distribution is best.

• No code?$\phantom{}$ Commented Jun 4, 2013 at 2:26
• Sharing your research helps everyone. Tell us what you found and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer:) Good Luck! Commented Jun 4, 2013 at 2:35

Something like this?

data = RandomVariate[NormalDistribution[0, 5], 10^4];
dist = {EstimatedDistribution[data, NormalDistribution[mu, sigma]],
EstimatedDistribution[data, StudentTDistribution[mu, sigma, 5]]};
pdfs = PDF[#, x] & /@ dist;
Show[{Histogram[data, Automatic, "ProbabilityDensity"],
Plot[pdfs, {x, Min[data], Max[data]}, PlotLegends -> dist]}]


• yes I have same problem, but I have new distribution and real data set. I have calculated predicted values, so how I can sketch same histogram with data sets.
– SAAN
Commented Jun 4, 2013 at 5:25
• Replace data with data={1,2,3,... } whatever your data set is and replace the NormalDistribution and StudentTDistribution with whatever you're using.
– Cam
Commented Jun 4, 2013 at 5:40
• thanks Cam for your reply, data={1,2,3,..} works but how i can replace NormalDistribution with the expression?
– SAAN
Commented Jun 4, 2013 at 6:14
• Just change dist, like this dist = {EstimatedDistribution[data,SkewNormalDistribution[mu, sigma, alpha]]}
– Cam
Commented Jun 4, 2013 at 6:22
• Really @Azeem, why are you being coy? Why not describe your problem in some detail (that is, edit your question), and maybe include this multiparameter distribution you speak of? Commented Jun 5, 2013 at 3:50