Visualizing multiple dimensions of Google Analytics in R

August 12, 2016

(This article was first published on Tatvic Blog » R, and kindly contributed to R-bloggers)

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")

Stacked bar chart


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")

    Heat map


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. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)