Questions tagged [histogram]

In statistics, a histogram is a graphical representation, showing a visual impression of the distribution of data.

In statistics, a histogram is a graphical representation, showing a visual impression of the distribution of data. It is an estimate of the probability distribution of a continuous variable and was first introduced by Karl Pearson. A histogram consists of tabular frequencies, shown as adjacent rectangles, erected over discrete intervals (bins), with an area equal to the of the observations in the interval. The height of a rectangle is also equal to the frequency density of the interval, i.e., the frequency divided by the width of the interval. The total area of the histogram is equal to the number of data. A histogram may also be normalized displaying relative frequencies. It then shows the proportion of cases that fall into each of several categories, with the total area equaling 1. The categories are usually specified as consecutive, non-overlapping intervals of a variable. The categories (intervals) must be adjacent, and often are chosen to be of the same size.

Histograms are used to plot density of data, and often for density estimation: estimating the probability density function of the underlying variable. The total area of a histogram used for probability density is always normalized to 1. If the length of the intervals on the x-axis are all 1, then a histogram is identical to a relative frequency plot.

In scientific software for statistical computing and graphics, The function hist generates a histogram. It can also optionally scale it so that its total area is 1. This puts it in the right scale if one want to overlay a probability density curve.

More about it here : histogram wiki

6663 questions
9
votes
2 answers

Displaying a histogram of image data

I sometimes need to display a representation of image data in the form of a histogram. I'm especially interested in ways to access the image data. I'm familiar with JFreeChart, which includes histogram support, but I'd consider other approaches.
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
9
votes
4 answers

Histogram equalization of grayscale images with NumPy

How to do histogram equalization for multiple grayscaled images stored in a NumPy array easily? I have the 96x96 pixel NumPy data in this 4D format: (1800, 1, 96,96)
pbu
  • 2,982
  • 8
  • 44
  • 68
9
votes
1 answer

Adding a density line to a histogram with count data in ggplot2

I want to add a density line (a normal density actually) to a histogram. Suppose I have the following data. I can plot the histogram by ggplot2: set.seed(123) df <- data.frame(x = rbeta(10000, shape1 = 2, shape2 = 4)) ggplot(df, aes(x = x)) +…
HBat
  • 4,873
  • 4
  • 39
  • 56
9
votes
1 answer

How to access 3D Histogram values in C++ using OpenCV?

I am trying to access an 3D histogram of a RGB image. But the histogram matrix returns the number of rows and columns equal to -1. I want to iterate through the histogram and check the individual values in the 3D matrix. But, when I check the number…
bikz05
  • 1,575
  • 12
  • 17
9
votes
1 answer

how to set bounds for the x-axis in one figure containing multiple matplotlib histograms and create just one column of graphs?

I am struggling to set xlim for each histogram and create 1 column of graphs so the x-axis ticks are aligned. Being new pandas, I am unsure of how to apply answer applies: Overlaying multiple histograms using pandas. >import from pandas import…
blehman
  • 1,870
  • 7
  • 28
  • 39
9
votes
1 answer

How should I pass a matplotlib object through a function; as Axis, Axes or Figure?

Sorry in advance if this is a little long winded but if I cut it down too much the problem is lost. I am trying to make a module on top of pandas and matplotlib which will give me the ability to make profile plots and profile matrices analogous to…
Keith
  • 4,646
  • 7
  • 43
  • 72
9
votes
3 answers

How to plot a superimposed bar chart using matplotlib in python?

I want to plot a bar chart or a histogram using matplotlib. I don't want a stacked bar plot, but a superimposed barplot of two lists of data, for instance I have the following two lists of data with me: Some code to begin with : import…
AnkitSablok
  • 3,021
  • 7
  • 35
  • 52
9
votes
1 answer

How to train HOG and use my HOGDescriptor?

I want to training data and use HOG algorithm to detect pedestrian. Now I can use defaultHog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector()); in opencv to detection, but the result is not very good to my testing video. So I want to do…
flammxy
  • 91
  • 1
  • 1
  • 3
9
votes
1 answer

How is the pyplot histogram bins interpreted?

I am confused about the matplotlib hist function. The documentation explains: If a sequence of values, the values of the lower bound of the bins to be used. But when I have two values in sequence i.e [0,1], I only get 1 bin. And when I have…
9
votes
1 answer

Finding the local maxima/peaks and minima/valleys of histograms

Ok, so I have a histogram (represented by an array of ints), and I'm looking for the best way to find local maxima and minima. Each histogram should have 3 peaks, one of them (the first one) probably much higher than the others. I want to do several…
9
votes
1 answer

OpenCV HOG feature data layout?

I'm working with OpenCV's CPU version of Histogram of Oriented Gradients (HOG). I'm using a 32x32 image with 4x4 cells, 4x4 blocks, no overlap among blocks, and 15 orientation bins. OpenCV's HOGDescriptor gives me a 1D feature vector of length 960.…
solvingPuzzles
  • 8,541
  • 16
  • 69
  • 112
9
votes
4 answers

Making a histogram of string values in python

OK so I have six possible values for data to be which are '32', '22', '12', '31', '21' and '11'. I have these stored as strings. Is it possible for python to sort through the data and just make six bins and show how many of each I have? Or do the…
Catherine Georgia
  • 879
  • 3
  • 13
  • 17
9
votes
1 answer

How can I superimpose an arbitrary parametric distribution over a histogram using ggplot?

How can I superimpose an arbitrary parametric distribution over a histogram using ggplot? I have made an attempt based on a Quick-R example, but I don't understand where the scaling factor comes from. Is this method reasonable? How can I modify it…
fmark
  • 57,259
  • 27
  • 100
  • 107
8
votes
2 answers

Consistent way to overlay data on histogram (extracting the binned data from geom_histogram?)

My goal is to create this plot in ggplot2: After a lot of fiddling around, I managed to create it for this one dataset, as per the screenshot above, with the following rather fragile code (note the width=63, boundary=410, which took lots of trial…
byteit101
  • 3,910
  • 2
  • 20
  • 29
8
votes
2 answers

fast 2dimensional histograming in matlab

I have written a 2D histogram algorithm for 2 matlab vectors. Unfortunately, I cannot figure out how to vectorize it, and it is about an order of magnitude too slow for my needs. Here is what I have: function [ result ] = Hist2D( vec0, vec1…
John
  • 5,735
  • 3
  • 46
  • 62