Excel does not yet know how to label the horizontal axis of our chart. Right-click the chart and choose “Select Data” to edit the axis labels. The “Select Data” choice on the chart context menu allows us to edit the axis labels. Right-click the chart and choose “Select Data” to edit the axis labels. Next, right-click a bar, and format the data series to reduce the gap width to 5% (or as desired): Change the chart title as you like. In the example shown, we pick up the value in cell B2: Final chart showing values plotted: Histogram with Data Analysis ToolPak. Another way to create a histogram in Excel is to use the Data Analysis ToolPak add-in. In Excel, the standard column chart will display all columns with the same width at regular intervals. However, in some circumstances, it would be better for the width of each column to be different. For example, where each column represents different ranges of data. This same principle of column width also applies to histograms.
- How To Modify Bin Width For A Histogram In Excel Machine
- How To Modify Bin Width For A Histogram In Excel Mac 2017
- How To Modify Bin Width For A Histogram In Excel Macros
- How To Modify Bin Width For A Histogram In Excel Mac 2016
- How To Modify Bin Width For A Histogram In Excel Macro
- Make a Histogram in Microsoft Excel 2016 for Mac A histogram displays the frequency values in a proportional graph. You're going to need some data to work with. Here's the data used in the example below. Type this into a blank worksheet: Follow these steps to make a really great looking histogram.
- Create a Binned Dimension: In the Data pane, right-click (control-click on Mac) a measure and select Create Bins. In the Create Bins dialog box, accept the proposed New field name or specify a different name for the new field. On the web, the dialog box is named Edit Bins and has a slightly different appearance, but the options are the same.
A histogram is a type of chart that uses rectangular bars to represent frequencies. It’s a helpful way to visualize the distribution of data values.
This tutorial explains how to create and modify histograms in Stata.
How to Create Histograms in Stata
We’ll use a dataset called auto to illustrate how to create and modify histograms in Stata.
First, load the data by typing the following into the Command box:
use http://www.stata-press.com/data/r13/auto
We can get a quick look at the dataset by typing the following into the Command box:
summarize
We can see that there are 12 total variables in the dataset.
Basic Histogram
We can create a histogram for the variable length by using the hist command:
hist length
Histogram with Frequencies
By default, Stata displays the density on the y-axis. You can change the y-axis to display the actual frequencies by using the freq command:
hist length, freq
Histogram with Percentages
You can also change the y-axis to display percentages instead of frequencies by using the percent command:
hist length, percent
Changing the Number of Bins
When you use the hist function in Stata, it automatically tells you how many “bins” it used. For example, in the previous examples it always used 8 bins:
However, we can specify the exact number of bins by using the bin() command. For example, the following code tells Stata to use 16 bins instead of 8:

hist length, percent bin(16)
We can also tell Stata to use fewer bins:
hist length, percent bin(4)

Notice that the more bins you use, the more granularity you can see in the data.
Adding a Normal Density to a Histogram
You can add a normal density curve to a histogram by using the normal command:
hist length, normal
How to Modify Histograms in Stata
We can use several different commands to modify the appearance of the histograms.
Adding a Title
We can add a title to the plot using the title() command:
hist length, title(“Distribution of Length”)
Adding a Subtitle
We can also add a subtitle underneath the title using the subtitle() command:
hist length, title(“Distribution of Length”) subtitle(“n = 74 cars”)
Adding a Comment
We can also add a note or comment at the bottom of the graph by using the note() command:
How To Modify Bin Width For A Histogram In Excel Machine

hist length, note(“Source: 1978 Automobile Data”)
Histograms
Histograms visually display your data. For categorical (nominal or ordinal) variables, the histogram shows a bar for each level of the ordinal or nominal variable. For continuous variables, the histogram shows a bar for grouped values of the continuous variable.
Highlighting data
Click a histogram bar or an outlying point in the graph. The corresponding rows are highlighted in the data table, and corresponding sections of other histograms are also highlighted, if applicable. See Highlight Bars and Select Rows.
Creating a subset
Double-click a histogram bar, or right-click a histogram bar and select Subset. A new data table that contains only the selected data is created.
Resizing the entire histogram
Place your cursor over the histogram borders until you see a double-sided arrow. Then click and drag the borders.
Rescaling the axis
Click and drag on an axis to rescale it.
Alternatively, place your cursor over the axis until you see a hand. Then, double-click the axis and set the parameters in the Axis Settings window.
Resizing histogram bars
(Available only for continuous variables.) There are multiple options to resize histogram bars. See Resize Histogram Bars for Continuous Variables.
Specifying your selection
Specify the data that you select in multiple histograms. See Specify Your Selection in Multiple Histograms.
To see additional options for the histogram or the associated data table:
• Right-click a histogram. See Using JMP.
• Right-click an axis. You can add a label or modify the axis. See Customize Axes and Axis Labels in the Axis Settings Window and Add and Remove Axis Labels in Using JMP.
• Click the red triangle next to the variable, and select Histogram Options. Options are slightly different depending on the variable modeling type. See Options for Categorical Variables or Options for Continuous Variables.
Resize Histogram Bars for Continuous Variables
Resize histogram bars for continuous variables by using the following:
• the Grabber (hand) tool
• the Set Bin Width option
• the Increment option
Use the Grabber Tool
The Grabber tool is a quick way to explore your data.
1. Select Tools > Grabber.
Note: (Windows only) To see the menu bar, you might need to place your cursor over the bar below the window title. You can also change this setting in File > Preferences > Windows Specific.
2. Place the grabber tool anywhere in the histogram.
3. Click and drag the histogram bars.
Think of each bar as a bin that holds a number of observations. For vertical histograms:
• Moving the hand to the left increases the bin width and combines intervals. The number of bars decreases as the bar size increases.
• Moving the hand to the right decreases the bin width, producing more bars.
• Moving the hand up or down shifts the bin locations on the axis, which changes the contents and size of each bin.
Note: If you have changed the histogram orientation to horizontal, reverse these directions. Move the hand down to increase bin width, up to decrease bin width, and left or right to shift bin locations on the axis.
Use the Set Bin Width Option
How To Modify Bin Width For A Histogram In Excel Mac 2017
The Set Bin Width option is a more precise way to set the width for all bars in a histogram. To use the Set Bin Width option, from the red triangle menu for the variable, select Histogram Options > Set Bin Width. Change the bin width value.
Use the Increment Option
The Increment option is another precise way to set the bar width. To use the Increment option, double-click the axis, and change the Increment value.
Highlight Bars and Select Rows
Clicking on a histogram bar highlights the bar and selects the corresponding rows in the data table. The appropriate portions of all other graphical displays also highlight the selection. Figure 3.6 shows the results of highlighting a bar in the height histogram. The corresponding rows are selected in the data table.
Tip: To deselect specific histogram bars, press the Control key and click the highlighted bars.
How To Modify Bin Width For A Histogram In Excel Macros
Figure 3.6 Highlighting Bars and Rows
Specify Your Selection in Multiple Histograms
How To Modify Bin Width For A Histogram In Excel Mac 2016
Extend or narrow your selection in histograms as follows:
• To extend your selection, hold down the Shift key and select another bar. This is the equivalent of using an or operator.
• To narrow your selection, hold down the Control and Alt keys (Windows) or Command and Option keys (macOS) and select another bar. This is the equivalent of using an and operator.
How To Modify Bin Width For A Histogram In Excel Macro
For an example, see Example of Selecting Data in Multiple Histograms.