New answers tagged

1

It depends on what you want. A hack is to generate data according to your bins. myData = {{1, 15}, {3, 6}, {4, 9}, {6, 10}}; Histogram[Flatten[ConstantArray[#[[1]], #[[2]]]& /@ myData], {1, 10, 1}] Otherwise you can also be more explicit an exploit the fact the the Histogram function allows you to specify functions for both the bins and the counts. ...


4

Suppose your data is in the form: myData = {{3, 6}, {4, 9}, {6, 10}}; meaning you want a histogram bar at position 3 of height 6, a bar at 4 of height 9, and so on. Then to get a true histogram, you can do this: Histogram[Flatten[Table[#[[1]], #[[2]]] & /@ myData], 10] or Histogram[Flatten[Table @@@ myData], 10] Having a true histogram makes ...


3

Histogram generates Rectangle objects as bars whose edges are set to be transparent. In your case the rectangles are so thin that you can thicken them simply by drawing their edges. This will apply to all bins though! yourhistogram = Histogram[imageData, {0, 2500, 1}, Frame -> True, ScalingFunctions -> "Log", (* Note the modified plot range! the ...


0

You can use Histogram[{x1,x2,x3...},bspec], where bspec is bin width specification. Simple example: data = RandomVariate[NormalDistribution[0, 1], 200]; Histogram[data, 5] Output: Alternatively, you could changethe presentation to see the bins better: Simple example: data1 = RandomVariate[NormalDistribution[0, 1], 500]; data2 = ...


1

Confirmation rather than answer. I'm not sure the original example is entirely functional, at least it was not for me. Mine is... SetDirectory["F:\\Temp"]; (* Adjust to suit your environment *) hist = Histogram[RandomVariate[NormalDistribution[0, 1], 10000], ScalingFunctions -> "Log", ImageSize -> 600] Note log scale on y-axis in resulting ...


3

Histogram does not process the PlotRange option. It just passes it on to the generated Graphics expression. PlotRange in Histogram does not affect how the histogram is computed. If you want to restrict the domain over which the histogram is computed, use a custom binning specification. Instead of {1}, use {30, 58, 1}. If you simply want to clip things ...


6

Here is an answer from the Wolfram Technical Support: Mathematica does not currently allow for an option for a logarithmic scale in ImageHistogram. However, taking apart the underlying structure, it is possible to rescale the data. The underlying structure is a GraphicsComplex, such that the following code should get you started on a workaround ...


0

Thank you very much to Scabolcs and rhermans. I have used ImageHistogram together with ParallelTable. For 10 images the improved code needs on my computer 2.51 sec (AbsoluteTiming) whereby the old code needed 124.22 sec. The speed is improved to a factor of about 50 ... great ... The only small but important difference is: I need a logarithmic y scale for ...


1

If you are simply interested in plotting the data, you can use ListStepPlot: ListStepPlot[A, "Center", Filling -> Axis, Joined -> False] Notes This will work with unevenly-spaced segments, since with the "Center" option, "the step extends to the center between neighboring points:" B = {{5, 0.0123445}, {15, 0.0342565}, {22, 0.0885784}, {38, ...


6

There seems to be a bug in version 10.1 that has been fixed in 10.3. You can always try writing your own random number generator. Here is a simple acceptance rejection method based on generalized Gaussian distributions as discussed here. Here I use a very naive envelope, a uniform distribution over {mu - s*sd, mu + s*sd} where mu is the mean of your ...


2

Alternatively, you could use WeightedData. a = {{5, 0.0123445}, {15, 0.0342565}, {25, 0.0885784}, {35, 0.184694}, {45, 0.243735}, {55, 0.223433}, {65, 0.111512}, {75, 0.000000}, {85, 0.000000}, {95, 0.1014466}}; Histogram[WeightedData @@ Transpose[a], Length[a]] You might also consider using DiscretePlot with an EmpiricalDistribution. dist = ...


3

You could simulate using EmpiricalDistribution. In the following I have changed A to a: ed = EmpiricalDistribution[#2 -> #1 & @@ (Transpose@a)]; Histogram[RandomVariate[ed, 10000], Automatic, "Probability"]


1

Similarl output to the above could be achieved using: Code: RectangleChart[a, ChartLabels -> a[[All, 1]], BarSpacing -> {10, 5}] Output:


2

Maybe a simple BarChart with labels would suffice? BarChart[list[[All, 2]], ChartLabels -> list[[All, 1]]] Total@list[[All, 2]] 1. Update Unevenly spaced segments list = {{5, 0.0123445}, {35, 0.0342565}, {45, 0.0885784}, {50, 0.184694}, {52, 0.243735}, {55, 0.223433}, {65, 0.111512}, {75, 0.000000}, {85, 0.000000}, {95, ...



Top 50 recent answers are included