Description Usage Arguments Value Author(s) References See Also Examples
Draw easily a scatter plot using ggplot2 package
| 1 2 3 4 5 6 7 | ggplot2.scatterplot(data, xName, yName, groupName = NULL,
  addRegLine = FALSE, regLineColor = "blue", regLineSize = 0.5,
  smoothingMethod = c("lm", "glm", "gam", "loess", "rlm"),
  addConfidenceInterval = FALSE, confidenceLevel = 0.95,
  confidenceIntervalFill = "#C7C7C7", setColorByGroupName = TRUE,
  setShapeByGroupName = FALSE, groupColors = NULL, brewerPalette = NULL,
  ...)
 | 
| data | data.frame or a numeric vector. Columns are variables and rows are observations. | 
| xName | The name of column containing x variable (i.e groups). | 
| yName | The name of column containing y variable. | 
| groupName | The name of column containing group variable. This variable is used to color plot according to the group. | 
| addRegLine | If TRUE, regression line is added. Default value is FALSE. | 
| regLineColor | Color of regression line. Default value is blue. | 
| regLineSize | Weight of regression line. Default value is 0.5. | 
| smoothingMethod | Smoothing method (function) to use, eg. lm, glm, gam, loess, rlm. For datasets with n < 1000 default is loess. For datasets with 1000 or more observations defaults to gam. lm for linear smooths, glm for generalised linear smooths, loess for local smooths, gam fits a generalized additive model. | 
| addConfidenceInterval | Display confidence interval around smooth? (FALSE by default). | 
| confidenceLevel | Level controling confidence region. Default is 95% | 
| confidenceIntervalFill | Fill color of confidence intervall | 
| setColorByGroupName | If TRUE, points are colored according the groups. Default value is TRUE. | 
| setShapeByGroupName | If TRUE, point shapes are different according to the group. Default value is FALSE. | 
| groupColors | Color of groups. groupColors should have the same length as groups. | 
| brewerPalette | This can be also used to indicate group colors. In this case the parameter groupColors should be NULL. e.g: brewerPalette="Paired". | 
| ... | Other parameters passed on to ggplot2.customize custom function or to geom_smooth and to geom_point functions from ggplot2 package. | 
a ggplot
Alboukadel Kassambara <alboukadel.kassambara@gmail.com>
http://www.sthda.com
| 1 2 3 4 5 6 7 8 9 10 | df <- mtcars
ggplot2.scatterplot(data=df, xName='wt',yName='mpg', size=3,
                mainTitle="Plot of miles per gallon \n according to the weight",
                xtitle="Weight (lb/1000)", ytitle="Miles/(US) gallon")
#Or use this
plot<-ggplot2.scatterplot(data=df, xName='wt',yName='mpg', size=3)
plot<-ggplot2.customize(plot, mainTitle="Plot of miles per gallon \n according to the weight",
                        xtitle="Weight (lb/1000)", ytitle="Miles/(US) gallon")
print(plot)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.