New answers tagged

3

data = {8, 9, 13, 13, 14, 18, 22, 27, 30, 34, 38, 38, 40, 44, 45, 47, 48, 48, 48, 48, 50, 53, 56, 57, 58, 58, 61, 63}; SeedRandom[1] values = RandomInteger[{1, 10}, Length@data] {2, 5, 1, 8, 1, 1, 9, 7, 1, 5, 2, 9, 6, 2, 2, 2, 4, 3, 2, 7, 1, 3, 7, 5, 6, 5, 4, 1} Construct a data set of pairs from data and values: pairs = Transpose[{data, values}]; ...


3

You have not defined what dataPnJ is, but this should get you started: Histogram[StringLength /@ DictionaryLookup[{"Spanish", "*"}]]


2

Riffing off of @kglr's excellent answer, we can go a little further and fulfill all your requirements regarding labeling of the bars within Histogram, without having to build our own BarChart: dataPnJ = StringLength[StringSplit[ExampleData[{"Text", "PrideAndPrejudice"}]]]; Histogram[ dataPnJ, {1}, "Probability", Ticks -> {Range[20], {#, PercentForm@#} ...


5

Histogram[dataPnJ, {1}, "Probability", Ticks -> {Automatic, {#, PercentForm @ #} & /@ Range[0, .5, .1]}, LabelingFunction -> (Placed[ PercentForm @ #, Tooltip] &)] You can also use HistogramList to get a list of bar heights and use it with BarChart: heights = HistogramList[dataPnJ, {1}, "Probability"][[2]]; BarChart[Labeled[#, Rotate[...


2

To show the "bump" around 5,000 I suspect that you might be estimating the probability density with the log of the values. If so, that makes sense for this set of data. But you aren't using the Log with the Mathematica code. Here's SmoothHistogram using the log: ticks = {Log[#], #} & /@ {0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, ...


2

Because your data is bounded by 1 (i.e., values less than 1 are likely impossible) and because the density isn't zero at 1, you need to use the "Bounded" option in SmoothHistogram (which unfortunately is only documented in SmoothKernelDistribution). SmoothHistogram[data, {Automatic, {"Bounded", {1, ∞}, "Gaussian"}}, "PDF", PlotRange -> {{0, 20}, {0, 1....


2

The problem is that the data is imported as a list of lists. data = Import["~/Downloads/polydistr.csv"]; data[[1;;5]] (* {{1.37525}, {1.09473}, {2.20973}, {1.28192}, {1.15815}} *) Import as list data = Import["~/Downloads/polydistr.csv", "List"]; data[[1;;5]] (* {1.37525, 1.09473, 2.20973, 1.28192, 1.15815} *) Histogram[data] SmoothHistogram[data, ...


4

Histogram[ StringLength[ ReadList[ StringToStream[ ExampleData[{"Text", "DonQuixoteIEnglish"}]], Word]], 20, ChartLabels -> Automatic]


17

Here's a similar figure with made-up data: dist1 = NormalDistribution[0.002, 1/100]; dist2 = NormalDistribution[-0.002, 1/10]; randomWalk[] := NestWhileList[# + 0.7 RandomVariate[dist1] + 0.3 RandomVariate[dist2] &, 0.5, 0 < # < 1 &]; SeedRandom[0] {foo, res} = Reap[Do[Sow[Length@#, Clip[Last@#, {0, 1}]] &@randomWalk[], {...


Top 50 recent answers are included