Saturday 30 August 2014

Bubble Charts in excel and in R

A Bubble chart is a variation of a Scatter chart in which the data points are replaced with bubbles. A Bubble chart can be used instead of a Scatter chart if your data has three data series, each of which contains a set of values. In a Bubble chart, the size of the bubbles is determined by the values in the third data series. Bubble charts are often used to present financial data. We are not limited to the circular markers provided by default in bubble charts. We can use the technique described in custom chart series markers to use any shape you want for the markers. Motion charts are animated bubble charts. They track the performance of important things over time (in two dimensions). This is chart with 4 dimensions. But not all data with 4 dimensions can be plotted as a motion chart. One dimension has to be time, and another has to be linked to the importance of the item. we can also turn any bubble chart into a quadrant chart. This is useful if you want to categorize your data a little further by using a common layout like it is used in a SWOT or market attractiveness analysis. 
Making bubble charts in R:
Step 1:                    
Download R and load the data into R for which a bubble chart has to be created. A .csv file with data in it can be read into R using the command read.csv
Step 2:
Circles can be drawn using the command symbols() and the values for x-axis, y-axis and bubbles are given. By default,symbols() sizes the largest bubble to one inch, and then scales the rest accordingly. It can be changed by using the inches argument.
Step 3:
To change the color of the bubbles we can use the arguments fg and bg to change the foreground and background colors respectively.
Eg:
symbols(table$cloumnname1, table$columnname2, circles=radius, inches=0.35, fg="white", bg="red", xlab="  ", ylab="  ")
The xlab and ylab arguments are used to name the X-axis and Y-axis.

The shapes of the bubbles can be changed by changing the values in the “inches” argument. This changes the shape of the circle to square or any other shape.

Sources:

No comments:

Post a Comment