R Statistics Cookbook
上QQ阅读APP看书,第一时间看更新

How to do it...

In this example, we will first create a histogram for the miles per gallon of vehicles from a dataset, and then produce a scatterplot showing the relationship between the miles per gallon and the horsepower of those vehicles. 

  1. We call the ggplot_shiny() function with an argument specifying that we want to work with the mtcars dataset:
library("ggplotgui")
ggplot_shiny(mtcars)

The following screenshot shows the ggplot GUI interface :

  1. Doing a scatterplot is equally simple—we need to just choose the Scatter option and then the X-variables and Y-variables. We could also choose a grouping variable if we wanted to incorporate an extra dimension into this plot: