Monday, April 1, 2013

xy bar plot (both X and Y axis are continous variables)

Usually with row or column plots in excel, one axis is categorical dat and other is numerical. However with some tricks, we can create a bar plot (row or column plot). Here is the trick.

(1) With a dummy dataset (where A column as names - not numbers and B column has number ) create a bar plot.

(2) Replace A column values with small bins created (minimum unit of data - for example 0.1 if our data is single decimal point or 1 if our data has no decimal point) in the range of Y data. Now trick is to fill Y value. For example if the width of bar is from 0.3 to 0.12 and height is 8, then we need to fill the cells like this:
X           Y
0.03 8
0.04 8
0.05 8
0.06 8
0.07 8
0.08 8
0.09 8
0.1 8
0.11 8
0.12 8

If there no data point in the X region keep it blank. Remove gap between bars by setting the series option bar gap to 0. You can manipulate labels (if over crowded) displayed after certain intervals.

In similarway we can plot stacked barplot.

No comments:

Post a Comment