1.191 FAQ-892 How to plot evenly spaced column/bar for unevenly spaced numeric X?
Last Update: 9/28/2020
Before Origin 2018, if user had numeric X and selected Y column(s) to plot column/bar plot, columns/bars were plotted at numeric X location so that they were not evenly spaced.
Since Origin 2018, we changed the behavior so that
- if user selects one Y column to plot, columns/bars are plotted at numeric X location as before.
- if user selects more than one Y columns to plot, column/bars are plotted with evenly spaced X. X tick labels are set as Text from X dataset.
If user really wants to show columns/bars at numeric X location, just double click on any X tick label and set Display Type as Numeric in Axis dialog. Then click Rescale to show all to see the update.
If user wants to roll the default behavior back to be the same as before Origin 2017, go to Preferences: System Variables... or Tools: System Viarables menu. set system variable @DRX as 0.
If column/bar are not evenly spaces but you want them as evenly spaced, there are four approaches.
Approach 1: Set X as Text before Plotting
- Double click X column header to open the Column Properties dialog. Set Format as Text under Options branch
- Plot column/bar graph.
!!!Drawback: Since the X column is changed to text, you will not be able to use it as numeric data for subsequent analysis such as curve fitting.
Approach 2: Use Plot Setup Dialog to Plot against Row Index
- Without any column selected in worksheet, select Plot > Basic 2D : Column menu to open Plot Setup dialog. In the middle panel, select <autoX> as X, and check col(B) as Y. Click Add button and then OK button to plot a column/bar graph.
- The tick labels will show 1, 2, 3, ... To show X values as tick labels, double click the X tick label to open the Axis dialog. On Tick Labels main tab, go to Display sub-tab, set Type to Text from dataset and select column A as Dataset.
Approach 3: Set X column as Disregard or Y column before Plotting
By default when user highlights some Y column(s) to plot, Origin will auto-find X column on the left and plot against it. If there is no X column on the left, then Origin will plot against row index.
- Right click X column header and select Set As: Disregard or Set As: Y from the context menu.
- Highlight column B to plot the column/bar graph.
- Same as Approach 2, the X tick labels is 1, 2, 3... by default. Double-click on any X tick label axis to open the Axis dialog. On Tick Labels tab, go to the Display sub-tab, set Type to Text from dataset and select column A as Dataset.
!!!Drawback: Since X column is set as disregard/Y column, when doing analysis, Origin will not find X column by default either.
Approach 4: Set Axis Type as Discrete
- If the graph is already created, double click on X axis to open the Axis dialog. On Scale tab, set Type to Discrete as below. Click Apply button.
- Now, the columns/bars are distributing evenly spaced. To make show X data as tick labels,
- Still on Scale tab, go to Major Ticks branch to specify X data as tick positions:
- Go to Tick Labels tab, in the Display sub-tab, set Tick Labels Type as Tick-indexed Dataset, and show X data as tick labels.
Keywords:unevenly spaced, column, bar, evenly spaceD, equally spaced, isometric, discrete