In Origin, histogram is plotted with equal bin width. But sometimes user wants to plot histogram with varying bin width to better illustrate the distribution of the data. This blog will show you how to do a frequency count with user-defined bin boundaries and then plot the result as a column plot with with varying column width to get the effect of histogram with varying bin width. and You can follow along with this blog by downloading the Histogram_Varying_Width zip file and open the it in Origin.
Here we have a modified set of sediment grain size data from a USGS survey, the distribution of data column C however varies considerably between different grain sizes. For this reason we’ll create a new column D and set long name to be Boundaries and enter some custom intervals- grain sizes between, 0, 25, 50, 100, 150, 200, 300, and 450 microns. After entering these values, we’ll select the grain size column C and bin our frequencies by going to Statistics>Descriptive Statistics>Frequency Counts to calculate counts in our customized bounary.
In this dialog, set Specify Binning Range by to User Defined Boundaries. Then in the Binning Range Data field, click > button and pick D(Y): Boundaries. Leave the rest of the settings as their defaults and click OK. A result sheet will be added in the workbook.
After closing the dialog we should see the frequency count worksheet containing the bin center, end and the counts for each bin. Add a new column and set its long name as Bin Width. Set the bin width values to based on Set Column Values dialog.
Once this has been done, we’ll select the Count column (column C) and plot the column plot below.
It uses Bin Center column (Column A) as X position of each column and they are plotted with same width. Some may overlap since X position may be close to each other.
To modify their width to fill the entirety of our x-axis, open the Plot Details dialog and then in the Spacing tab of our plot change the widths % to be represented by Col(E) with a scaling factor of 0. When the scaling factor is set to 0, Origin will use the widths given in column E as proportional sections of the total x-range, or rather their width will fill the entirety of the x-axis between the min and max of our data.
Click OK, our column graph should appear as it does above due to the default margin settings of Origin.
We can change the axis from and to to be the from 0 to 450, our customized grain size boundary.
We have now created a histogram with varying bin width illustrating the disparate frequency of different particle sizes in our sediment data. With some final touches, this is how you create a variable width column graph in Origin and OriginPro. You can find the final graph on Result folder of the opj file.