0
$\begingroup$

I'm trying to plot a density of states out of a list of energy values, and on it I want to include another over-layed plot with it that shows some fraction of that density of states at different values, that I have as another list. I've been doing this with the SmoothHistogram function, which gives the correct shape of the plot, but the normalization of each plot screw up what I'm trying to accomplish. Is there any way to make a SmoothHistogram-like plot without normalizing the integration of my data? I've attempted plotting a single gaussian for each point in my list, but it takes a long time to plot it like that. Each list can be thousands of elements long.

list1 = RandomReal[100, 1000];
list2 = plot1*RandomReal[1,1000];
SmoothHistogram[list1]
SmoothHistogram[list2]
SmoothHistogram[{list1,list2}]

I want the plot of list2 to be some fraction of list1, and SmoothHistogram normalizes each plot before over-laying them.

$\endgroup$
2
  • $\begingroup$ what's plot1 ? $\endgroup$
    – george2079
    Nov 14, 2014 at 21:44
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – user9660
    Nov 14, 2014 at 21:47

1 Answer 1

1
$\begingroup$

Im not sure exactly what you are after, but here is a trick to rescale the SmoothHistogram result

 list1 = RandomVariate[NormalDistribution[0, 1], 500];
 Show[ {
          Histogram[list1] ,
          SmoothHistogram[list1] /. 
            Line[x_] :> Line[ {#[[1]], #[[2]] 250} & /@ x] }]

enter image description here

another approach is:

 d = PDF[SmoothKernelDistribution[list1]];
 Show[
   Histogram[list1],
   Plot[ 100 d[x]/d[0] , {x, -5, 5}]  ]

essentially the same plot

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.