Visualizing multiple dimensions of Google Analytics in R
[This article was first published on Tatvic Blog » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Stack bar chart
- It is used when we wish to visualize a combination of categorical variables
ggplot(data, aes(date, fill = region)) + geom_bar()+ labs(title = "Stacked Bar Chart", x = "Date", y = "Count of Regions") where date : ga:date and region : ga:region
- Example
ggplot(train, aes(Outlet_Location_Type, fill = Outlet_Type)) + geom_bar()+ labs(title = "Stacked Bar Chart", x = "Outlet Location Type", y = "Count of Outlets")
Heat Map
-
It uses intensity (density) of colors to display relationship between two or three or many variables in a two dimensional image.
- It allows us to explore two dimensions as the axis and the third dimension by intensity of color.
ggplot(data, aes(date, region)) + geom_raster(aes(fill = transactions))+ labs(title ="Heat Map", x = "Date", y = "Region")+ scale_fill_continuous(name = "Transactions") where date : ga:date, region : ga:region and transactions : ga:transactions
-
Example
ggplot(train, aes(Outlet_Identifier, Item_Type)) + geom_raster(aes(fill = Item_MRP)) + labs(title ="Heat Map", x = "Outlet Identifier", y = "Item Type") + scale_fill_continuous(name = "Item MRP")
The post Visualizing multiple dimensions of Google Analytics in R appeared first on Tatvic Blog.
To leave a comment for the author, please follow the link and comment on their blog: Tatvic Blog » R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.