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
2
votes
1 answer

Can't get a Histogram (matplotlib.pyplot.hist) to update for new data in tkinter

I am making a gui using tkinter and matplotlib in python. It displays data and graphs spread over several notebook tabs. As the user makes certain selections the graphs and text update. Everything was working perfectly until I added a histogram. …
Paul O
  • 425
  • 5
  • 19
2
votes
0 answers

How to remove inside border for a stratified histogram without using package

i am writing up a function to generate a stratified histogram. Here is my code. i would like to remove the inside border (so those stack counts are separated by colour only, not colour and border). any ideas? data("iris") strathist = function(x,…
ZWL
  • 319
  • 2
  • 4
2
votes
2 answers

How to determine the locations of bars in a bar plot?

I've got a problem to find the exact location of a MATLAB bar-plot with multiple bars. Using the following code A =[2.1974e-01 4.1398e-01 1.0889e-01 3.3550e-01; 4.2575e-01 5.2680e-01 2.3446e-01 9.7119e-02; 2.5702e+00 2.5594e+00 …
madn
  • 23
  • 2
2
votes
1 answer

How to plot 2-D histogram of a normalized RGB image in Matlab

I have an original RGB JPEG image of which I have created a normalized RGB image. I'm able to plot the histrogram for this normalized RGB image. I need to now plot a 2-d histogram of the normalized RGB image, where the 2 axes represent the…
Sakshi
  • 29
  • 11
2
votes
3 answers

How to shift the XtickLabels of a bar graph to the left?

I'm currently trying to create a frequency histogram, and to do this, I had to create a bar graph that has no whitespace between the bars. However, this centers the XTickLabels in the middle of the bars. Since it's a histogram, I would like the…
Stephen Burns
  • 162
  • 2
  • 17
2
votes
1 answer

Octave plot breaks when setting axis scale to log

I am trying to plot an histogram with the following script: for i = 1:100 edges(i) = i * 10; end [n] = histc(x, edges); bar(edges, n, 'histc'); When I try to set the axis to a log scale using set(gca, 'xscale', 'log') I get the following…
djscuf
  • 63
  • 6
2
votes
2 answers

r percentage by bin in histogram ggplot

I have a data set like this -> library(ggplot2) response <- c("Yes","No") gend <- c("Female","Male") purchase <- sample(response, 20, replace = TRUE) gender <- sample(gend, 20, replace = TRUE) df <- as.data.frame(purchase) df <-…
John Bennett
  • 33
  • 1
  • 6
2
votes
1 answer

Let axvline end at certain y-value

I was plotting a histogram with pandas and pyplot. For additional information, I added lines at certain percentiles of the histogram distribution. I already found out that you can make a axvline appear with a certain % height of the whole chart:…
VeryMary
  • 65
  • 1
  • 8
2
votes
2 answers

Split histogram into different regions in Matlab

I have an Image histogram using imhist and it contains 3 different regions like the attached image shows, I want to get the borders or the interval of the largest continuous area of the histogram, in this case, the second region is the one that I am…
K.soula
  • 45
  • 4
2
votes
1 answer

R stacked % frequency histogram with percentage of aggregated data based on

I believe my question is very similar to this post. Only difference is my aes fill is a factor with multiple levels. This what I am after and this is how far I have gotten set.seed(123) n = 100 LoanStatus = sample(c('Chargedoff', 'Completed',…
CRich
  • 118
  • 1
  • 1
  • 7
2
votes
2 answers

Change the axis units on a histogram using seaborn

I'm working on the boston housing project of the udacity ML nano degree which use the following data set: I'm using seabron to plot an histogram of the data: df = pd.read_csv('housing.csv') sns.distplot(df['MEDV']) Which looks ok, but I don't like…
Luis Ramon Ramirez Rodriguez
  • 9,591
  • 27
  • 102
  • 181
2
votes
2 answers

Plotting multiple histograms quickly in R

For exploratory analysis, its often useful to quickly plot multiple variables in one grid. An easy way to do this is to: data(mtcars) hist(mtcars[,c(1,2,3,4)]) However, it becomes difficult to adjust breaks and axes to maintain consistency…
Gooze
  • 110
  • 1
  • 1
  • 11
2
votes
2 answers

Error in plotting histogram from dictionary

I have a dictionary with 7191 keys, and the values represent the frequency of each key. degree_distri = {'F2': 102, 'EGFR': 23, 'C1R': 20,...} To plot the histogram, I did: plt.bar(list(degree_distri.keys()), degree_distri.values(), color='r')…
hsy_99
  • 55
  • 6
2
votes
0 answers

Create a histogram in OxyPlot using c# wpf

I'm trying to create a histogram in oxyplot. I followed the documentation on oxyplot.org (using ColumnSeries) and ended up with a histogram looking like this: And my code looks like this: namespace WpfApplication1 { /// ///…
coder
  • 538
  • 7
  • 17
2
votes
1 answer

Earth movers distance in torch/lua (or how to use a criterion to just obtain a comparison)

I'm trying to calculate the distance between two histograms in torch7, in order to do this I was thinking about using the earth mover's distance. Now I know it's not that hard to do this in python using something like…
Thijser
  • 2,625
  • 1
  • 36
  • 71