0
$\begingroup$

I have the following code.

a = RandomInteger[{0, 1}, {10000, 1000}];
Histogram[Total[a, {2}], PlotRange -> {{0, 1000}, Automatic}]

I want to scale the y axis by a factor of 1000 in order to normalize. Could you please help me with that?

$\endgroup$
1
  • 1
    $\begingroup$ You need to import into something, i.e., blah=Import... and use that in your histogram. Also, seems like the result you're after is simply using "Probability" as the hspec in Histogram. Lastly, if you want to do such a simulation, no need to generate 10 million RV, just use something like tots = RandomVariate[BinomialDistribution[1000, 1/2], 10000], get the totals directly with only 10000 rv generated... $\endgroup$ – ciao Sep 23 '16 at 0:48
2
$\begingroup$
Histogram[Total[a, {2}], Automatic, #2/1000 &, 
 PlotRange -> {{0, 1000}, Automatic}, Frame -> True]

enter image description here

$\endgroup$
2
  • $\begingroup$ I tried the code after exporting and then importing the table into a new nb file. I edited the question. #2/1000& did not work for the imported data. $\endgroup$ – Shawn Sep 23 '16 at 0:31
  • $\begingroup$ You have to name the Import as coin1000; also, what are you Exporting: a or Total[a,{2}]? Moreover, Import/Export of data is a different issue than plotting a histogram so in this case you should've posted a new question; don't extend the question, once it was answered, way beyond its initial scope. $\endgroup$ – corey979 Sep 23 '16 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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