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

gnuplot stacked histogram overlapping

I have the following two data files I want to plot using gnuplot. timings0.log: 41420 32587 4082 4668 81 547 325 timings1.log: 41297 32393 4106 4720 75 502 266 They represent timings of different components of a piece of software, where each file…
Pyves
  • 6,333
  • 7
  • 41
  • 59
11
votes
4 answers

Binning an array in javascript for a histogram

I have below array in Javascript which I need to bin into 20 buckets. The data values are between 0 and 1, so the bin size would be .05. I feel like there should be a function out there that takes two arguments, an array and a bin size, but I cannot…
NodeJS_dev
  • 231
  • 1
  • 5
  • 12
11
votes
1 answer

GridSpec of multiple subplots "the figure containing the passed axes is being cleared"

I have 4 different df.hist(columns=, by=) that I would like to insert inside of a GridSpec(2, 2). Each one of them looks like this : Here is the code : stuff = [df1, df2, df4, df3] col = ['blue', 'orange', 'grey', 'green'] fig =…
gowithefloww
  • 2,211
  • 2
  • 20
  • 31
11
votes
1 answer

access to bin counts in seaborn distplot

In pyplot's hist() function, we are able to access the values of the histogram bins (through the return n); is it possible to access this same information from Seaborn's distplot? Seaborn only returns an axis object. Ultimately, I'd like juxtapose…
Constantino
  • 2,243
  • 2
  • 24
  • 41
11
votes
2 answers

Histogram conditional fill color

I would like to make a histogram where the fill color changes depending on the low end of the bin. I do not want a manual fill. This answer seems promising, but I could not transition it successfully to a histogram and two-value (not gradient)…
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
11
votes
1 answer

Drawing histograms or densities along smooth curves using ggplot2

Is there a general way to draw densities (violin plots) or histograms showing the distribution of x along a smooth (x,y) curve? I use this approach to show the marginal distribution of x when there are multiple groups (e.g., different curves on one…
Frank Harrell
  • 1,954
  • 2
  • 18
  • 36
11
votes
1 answer

R - histogram rectangles line thickness

How can I get the actual lines (that form the many rectangles) on a histogram to be thicker? I would like to avoid using ggplot. Here is some code that generates a histogram so that we have a reproducible example: h =…
CodeGuy
  • 28,427
  • 76
  • 200
  • 317
11
votes
6 answers

3D histogram with gnuplot or octave

I would like to draw a 3D histogram (with gnuplot or octave) in order to represent my data. lets say that I have a data file in the following form: 2 3 4 8 4 10 5 6 7 I'd like to draw nine colored bars (the size of the matrix), in the set…
user3733333
  • 161
  • 1
  • 2
  • 7
11
votes
2 answers

Histogram of two variables in R

I have two variables that I want to compare in a histogram like the one below. For each bin of the histogram the frequency of both variables is shown what makes it easy to compare them.
alex
  • 833
  • 4
  • 12
  • 21
10
votes
2 answers

How to use the function curve in [R] to graph a normal curve?

I'm trying to make a histogram in [R], and the normal curve that describes the histogram as follows: w<-rnorm(1000) hist(w,col="red",freq=F,xlim=c(-5,5)) curve(dnorm(w),-5,5,add=T,col="blue") But when I try to plot the normal curve by curve…
franvergara66
  • 10,524
  • 20
  • 59
  • 101
10
votes
1 answer

Basic histogram in JFreeChart

I need to create a simple histogram using JFreeChart. There should be 3 groups with numeric values assigned to each of these groups. The problem is that DefaultCategoryDataset requires specifying "Group" and "Subgroup" (i.e.…
Klausos Klausos
  • 15,308
  • 51
  • 135
  • 217
10
votes
4 answers

sorting images by color

I'm looking for a way to sort images as in the following screenshot: http://www.pixolution.de/sites/LargeImages_en.html I've looked at all the threads on this topic on stackoverflow but none of the proposed solutions even come close to giving me the…
user257543
  • 881
  • 1
  • 14
  • 35
10
votes
1 answer

How to add summary statistics in histogram plot using ggplot2?

I want to add summary statistics in histogram plot made using ggplot2. I am using the following code #Loading the required packages library(dplyr) library(ggplot2) library(reshape2) library(moments) library(ggpmisc) #Loading the data df <-…
UseR10085
  • 7,120
  • 3
  • 24
  • 54
10
votes
2 answers

how to change the dimensions of a histogram depicted by plt.hist() as figsize is not an argument

I am trying to plot a histogram with a series using numpy array. n,bins,patch = plt.hist(ser,bins=10, color='green', alpha=0.8, label='Value', edgecolor='orange', linewidth=2) plt.legend() plt.ylabel('No of bags', size='x-large') plt.xlabel('Money…
Deshwal
  • 3,436
  • 4
  • 35
  • 94
10
votes
3 answers

Plotting the degree distribution of a graph using nx.degree_histogram

I've tried to use the following code to plot the degree distribution of the networkx.DiGraph G: def plot_degree_In(G): in_degrees = G.in_degree() in_degrees=dict(in_degrees) in_values = sorted(set(in_degrees.values())) in_hist =…
Amit Mek
  • 105
  • 1
  • 1
  • 5