# HISTOGRAM

**AXCEL.VIZ.HISTOGRAM function**

This function generates histogram of input data.

**Syntax**

AXCEL.VIZ.HISTOGRAM(data, [cumulative], [stacked], [orientation], [bins], [probability], [gap], [title], [deployment])

The AXCEL.VIZ.HISTOGRAM function syntax has the following arguments:

**data** Required. data must be a minimum of one column. If additional columns are provided, they will be presented in the histogram based on stacked selection.

value1 | value2(optional) | value …n(optional) |

3.5 | 1.4 | … |

3 | 1.4 | … |

3.2 | 1.3 | … |

3.1 | 1.5 | … |

… | … | … |

For non-numeric entries such as Group in above example, you should add “.f” at the end of column name to identify it as factor. Axcel automatically aggregates each factor and display them as a histogram. For instance, in above mentioned dataset, if *value1* is a factor variable of a,b,… which is not numerical, we should present this column as follows:

value1.f |

a |

a |

b |

b |

… |

**cumulative** Optional. Default is FALSE. If set TRUE, a cumulative histogram is generated.

**stacked **Optional. Default is FALSE which shows multiple histograms data in their corresponding separate bars. You should set it TRUE, if you would like to stack and show them in a single set of bins.

**orientation** Optional. Default is vertical. If you can set it to [h]orizontal, if you would like to have the charts presented horizontally.

**bins** Optional. By default, Axcel identifies the best number of bins to generate histogram. However, you can define your bin setup in two ways:

- If you define bins as a single number, Axcel consider as the maximum number of bins and calculates the best bin setup by considering this constraint.
- You can define bins as a vector of [Start, End, Size] as well. In this case, Axcel respects these constraints and define the bins based on this vector of configurations.

**probability** Optional. Default is FALSE which shows the number of members in each group. If it is set TRUE, the outcome is normalized and the probability of each bin will be presented.

**gap** Optional. By default, Axcel applies 0.1 gap between bars. You can define yours including 0 to show all bars side by side.

**title** Optional. By default, Axcel tries to find the title from your data such as the name of the first column. Otherwise, you can explicitly define the title of your graph.

**deployment** Optional. It is the deployment in project/name or owner/project/name format. You need to create a project by logging into your console (https://console.axcel.io) -> Project -> Create Project. After that you can use the project name in your deployment. Please note project and visualization names contain small letters and numbers only. If a project is shared with you, you should use the username of the owner in your deployment. Please visit visualization projects and sharing to learn more about this powerful feature.

when you type *=AXCEL.VIZ.HISTOGRAM* in an Excel cell, the IntelliSense guides you through required and optional (shown in [] brackets) inputs. Here are examples.

**Example:**

We have three sets of 500 random numbers from a normal distribution with average of 0, 1 and 4 which is located in cells A1 to C501:

sample1 | sample2 | sample3 |

-0.2579403 | 0.74205968 | 3.74205968 |

-1.0111622 | -0.0111622 | 2.98883777 |

0.89866091 | 1.89866091 | 4.89866091 |

-1.2901658 | -0.2901658 | 2.70983416 |

0.28881633 | 1.28881633 | 4.28881633 |

… | … | … |

… | … | … |

Let’s start by showing the histogram of the first column with the title of “Random Samples”:

=AXCEL.VIZ.HISTOGRAM(A1:A501,,,,,,,”Random Samples”)

And here is the output:

Now let’s show the cumulative numbers:

=AXCEL.VIZ.HISTOGRAM(A1:A501,TRUE,,,,,,”Random Samples”)

and the output is:

=AXCEL.VIZ.HISTOGRAM(A1:A501,,,TRUE,,,,”Random Samples”)

Which results in:

we can limit the number of bins to 10 (10 is the considered the maximum number of bins):

=AXCEL.VIZ.HISTOGRAM(A1:A501,,,,10,,,”Random Samples”)

which shows the results in 6 bins:

We can define the bins more specifically. For instance, let’s set the minimum to 0, max 1 with 0.1 steps. We put this specification in cell E4:G4:

=AXCEL.VIZ.HISTOGRAM(A1:A501,,,,E4:G4,,,”Random Samples”)

and here is the result:

Let’s keep the same specification but normalize the result to show probabilities:

=AXCEL.VIZ.HISTOGRAM(A1:A501,,,,E4:G4,TRUE,,”Random Samples”)

As presented below, Y-axis shows the probabilities instead of number of members in each bin:

Let’s go back to original graph but add Sample2 and Sample 3 columns:

=AXCEL.VIZ.HISTOGRAM(A1:C501,,,,,,,”Random Samples”)

All three samples are shown in separate histograms as shown below:

And, If you would like to stack them:

=AXCEL.VIZ.HISTOGRAM(A1:C501,,TRUE,,,,,”Random Samples”)

Lastly, if you would like to show bins without gap:

=AXCEL.VIZ.HISTOGRAM(A1:C501,,TRUE,,,,0,”Random Samples”)

Which changes the graph as shown below:

See also Visualization Projects and Sharing