ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (2024)

  • Introduction
  • Install and load easyGgplot2 package
  • Data format
  • Basic stripchart
  • Stripchart with mean point
  • Change the stripchart point shape
  • Customize your stripchart
    • Parameters
    • Main title and axis labels
    • Axis ticks
    • Background and colors
      • Change stripchart background and fill colors
      • Change stripchart color according to the group
    • Legend
      • Legend position
      • Legend background color, title and text font styles
      • Change the order of items in the legend, remove plot legend
    • Axis scales
    • Create a customized plots with few R code
  • Stripchart with multiple groups
  • Facet : split a plot into a matrix of pannels
    • Facet with one variable
    • Facet with two variables
    • Facet scales
    • Facet label apperance
  • ggplot2.stripchart function
    • Description
    • usage
    • Arguments
    • Examples
  • Easy ggplot2 ebook
  • Infos

ggplot2.stripchart is an easy to use function (from easyGgplot2 package), to produce a stripchart using ggplot2 plotting system and R software. Stripcharts are also known as one dimensional scatter plots (or dot plots). These plots are suitable compared to box plots when sample sizes are small.

The aim of this tutorial is to show you step by step, how to plot and customize a stripchart using ggplot2.stripchart function.

At the end of this tutorial you will be able to draw, with few R code, the following plots :

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (1)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (2)

ggplot2.stripchart function is described in detail at the end of this document.

easyGgplot2 R package can be installed as follow :

install.packages("devtools")library(devtools)install_github("easyGgplot2", "kassambara")

Load the package using this R code :

library(easyGgplot2)

The data must be a numeric vector or a data.frame (columns are variables and rows are observations).

ToothGrowth data is used in the following examples.

# create a numeric vectornumVector<-rnorm(100)head(numVector)
## [1] -0.7958 0.1623 2.1102 0.5006 0.2491 -1.5663
# data.framedf <- ToothGrowthhead(df)
## len supp dose## 1 4.2 VC 0.5## 2 11.5 VC 0.5## 3 7.3 VC 0.5## 4 5.8 VC 0.5## 5 6.4 VC 0.5## 6 10.0 VC 0.5

ToothGrowth describes the effect of Vitamin C on Tooth growth in Guinea pigs. The response is the length (len) of teeth in each of 10 guinea pigs at each of three dose levels of Vitamin C (0.5, 1, and 2 mg) with each of two delivery methods (orange juice or ascorbic acid).

The data is a data frame with 60 observations on 3 variables.* [,1] len numeric Tooth length.* [,2] supp factor Supplement type (VC or OJ).* [,3] dose numeric Dose in milligrams.

# Stripchart from a single numeric vector ggplot2.stripchart(data=numVector)# Basic stripchart from the vector "len"ggplot2.stripchart(data=df, xName='dose',yName='len')#change dot sizeggplot2.stripchart(data=df, xName='dose',yName='len', size=3)# Change the orientation: Horizontal stripchartggplot2.stripchart(data=df, xName='dose',yName='len', orientation="horizontal")# Stripchart with box plotggplot2.stripchart(data=df, xName='dose',yName='len', addBoxplot=TRUE)# stripchart with notched box plotggplot2.stripchart(data=df, xName='dose',yName='len', addBoxplot=TRUE,notch=TRUE)

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (3)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (4)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (5)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (6)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (7)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (8)

notch: If TRUE, make a notched box plot. The notch displays a confidence interval around the median which is normally based on the median +/- 1.57 x IQR/sqrt of n. Notches are used to compare groups; if the notches of two boxes do not overlap, this is strong evidence that the medians differ.

To change the size of dots, use the argument ‘size’ (e.g : size = 4)

Each dot represents one observation and the mean point corresponds to the mean value of the observations in a given group.

# Stripchart with mean pointggplot2.stripchart(data=df, xName='dose',yName='len', addMean=TRUE, meanPointShape=23, meanPointSize=4, meanPointColor="black", meanPointFill="blue")# Change the stripchart colorggplot2.stripchart(data=df, xName='dose',yName='len', colour="red")

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (9)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (10)

Different point shapes and line types can be used in the plot. By default, ggplot2 uses solid line type and circle shape.

  • The different point shapes in R are described here.
  • The available line types are shown here.
# Change point shapeggplot2.stripchart(data=df, xName='dose',yName='len', shape=18)# Change point shapeggplot2.stripchart(data=df, xName='dose',yName='len', shape=17)

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (11)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (12)

Parameters

The arguments that can be used to customize x and y axis are listed below :

ParametersDescription
mainTitlethe title of the plot
mainTitleFonta vector of length 3 indicating respectively the size, the style (“italic”, “bold”, “bold.italic”) and the color of x and y axis titles. Default value is: mainTitleFont=c(14, “bold”, “black”).
xShowTitle, yShowTitleif TRUE, x and y axis titles will be shown. Set the value to FALSE to hide axis labels. Default values are TRUE.
xtitle, ytitlex and y axis labels. Default values are NULL.
xtitleFont, ytitleFonta vector of length 3 indicating respectively the size, the style and the color of x and y axis titles. Possible values for the style:“plain”, “italic”, “bold”, “bold.italic”. Color can be specified as an hexadecimal code (e.g: “#FFCC00”) or by the name (e.g : “red”, “green”). Default values are xtitleFont=c(14,"bold", "black"), ytitleFont=c(14,"bold", "black").
xlim, ylimlimit for the x and y axis. Default values are NULL.
xScale, yScalex and y axis scales. Possible values : c(“none”, “log2”, “log10”). e.g: yScale=“log2”. Default values are NULL.
xShowTickLabel, yShowTickLabelif TRUE, x and y axis tick mark labels will be shown. Default values are TRUE.
xTickLabelFont, yTickLabelFonta vector of length 3 indicating respectively the size, the style and the color of x and y axis tick label fonts. Default value are xTickLabelFont=c(12, "bold", "black"), yTickLabelFont=c(12, "bold", "black").
xtickLabelRotation, ytickLabelRotationRotation angle of x and y axis tick labels. Default value are 0.
hideAxisTicksif TRUE, x and y axis ticks are hidden. Default value is FALSE.
axisLinea vector of length 3 indicating respectively the size, the line type and the color of axis lines. Default value is c(0.5, "solid", "#E5E5E5").

For more details follow this link : ggplot2.customize.

Main title and axis labels

# Change main title and axis titlesggplot2.stripchart(data=df, xName='dose',yName='len', mainTitle="Plot of length \n by dose", xtitle="Dose (mg)", ytitle="Length")# Customize title styles. Possible values for the font style : # 'plain', 'italic', 'bold', 'bold.italic'.ggplot2.stripchart(data=df, xName='dose',yName='len', xtitle="Dose (mg)", ytitle="Length", mainTitle="Plot of length \n by dose", mainTitleFont=c(14,"bold.italic", "red"), xtitleFont=c(14,"bold", "#993333"), ytitleFont=c(14,"bold", "#993333"))# Hide x an y axis titlesggplot2.stripchart(data=df, xName='dose',yName='len', xShowTitle=FALSE, yShowTitle=FALSE)

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (13)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (14)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (15)

Axis ticks

# Axis ticks labels and orientaionggplot2.stripchart(data=df, xName='dose',yName='len', xShowTitle=FALSE, yShowTitle=FALSE, xTickLabelFont=c(14,"bold", "#993333"), yTickLabelFont=c(14,"bold", "#993333"), xtickLabelRotation=45, ytickLabelRotation=45)# Hide axis tick labelsggplot2.stripchart(data=df, xName='dose',yName='len', xShowTitle=FALSE, yShowTitle=FALSE, xShowTickLabel=FALSE, yShowTickLabel=FALSE)# Hide axis ticksggplot2.stripchart(data=df, xName='dose',yName='len', xShowTitle=FALSE, yShowTitle=FALSE, xShowTickLabel=FALSE, yShowTickLabel=FALSE, hideAxisTicks=TRUE)# AxisLine : a vector of length 3 indicating the size, #the line type and the color of axis linesggplot2.stripchart(data=df, xName='dose',yName='len', axisLine=c(1, "solid", "darkblue"))

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (16)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (17)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (18)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (19)

Background and colors

Change stripchart background and fill colors

# change background color to "white". Default is "gray"ggplot2.stripchart(data=df, xName='dose',yName='len', backgroundColor="white")# Change background color to "lightblue" and grid color to "white"ggplot2.stripchart(data=df, xName='dose',yName='len', backgroundColor="lightblue", gridColor="white")# Change plot fill colorggplot2.stripchart(data=df, xName='dose',yName='len', backgroundColor="white", fill='#FFAAD4')# remove grid; remove top and right borders around the plot;# change axis linesggplot2.stripchart(data=df, xName='dose',yName='len', backgroundColor="white", fill='#FFAAD4', removePanelGrid=TRUE,removePanelBorder=TRUE, axisLine=c(0.5, "solid", "black"))

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (20)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (21)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (22)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (23)

Change stripchart color according to the group

Colors can be specified as a hexadecimal RGB triplet, such as "#FFCC00" or by names (e.g : "red" ). You can also use other color scales, such as ones taken from the RColorBrewer package. The different color systems available in R have been described in detail here.

To change stripchart color according to the group, you have to specify the name of the data column containing the groups using the argument groupName. Use the argument groupColors, to specify colors by hexadecimal code or by name. In this case, the length of groupColors should be the same as the number of the groups. Use the argument brewerPalette, to specify colors using RColorBrewerpalette.

# Color the stripchart accoording to the groupName "dose"ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose')# Change group colors using hexadecimal colorsggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', groupColors=c('#999999','#E69F00','#56B4E9'))# Change group colors using brewer palette: "Paired"ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose',brewerPalette="Paired")

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (24)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (25)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (26)


Color can also be changed by using names as follow :

# Change group colors using color namesggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', groupColors=c('aquamarine3','chartreuse1','goldenrod1'))

Legend

Legend position

# Change the legend position to "top" # (possible values: "left","top", "right", "bottom")ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', legendPosition="top")# legendPosition can be also a numeric vector c(x, y)ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', legendPosition=c(0.8,0.2))

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (27)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (28)

It is also possible to position the legend inside the plotting area. You have to indicate the x, y coordinates of legend box. x and y values must be between 0 and 1. c(0,0) corresponds to “bottom left” and c(1,1) corresponds to “top right” position.

Legend background color, title and text font styles

# Change legend background color, title and text font stylesggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', #legendTitleFont=c(size, style, color) legendTitle="Dose (mg)", legendTitleFont=c(10, "bold", "blue"), #legendTextFont=c(size, style, color) legendTextFont=c(10, "bold.italic", "red"), #legendBackground: c(fill, lineSize, lineType, lineColor) legendBackground=c("lightblue", 0.5, "solid", "darkblue" ) )

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (29)

Change the order of items in the legend, remove plot legend

# Change the order of items in the legend # legendItemOrder : character vector indicating # the order of items in the legends.ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', legendItemOrder=c("2", "1", "0.5"))# Remove plot legendggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', showLegend=FALSE)

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (30)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (31)

Axis scales

Possible values for y axis scale are “none”, “log2” and log10. Default value is “none”.

# Change y axis limitggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', ylim=c(0,50))# y Log scale. yScale="log2". # Possible value="none", "log2" and "log10"ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', yScale="log2")

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (32)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (33)

Create a customized plots with few R code

# Customized stripchartggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', groupColors=c('#999999','#E69F00','#56B4E9'), showLegend=FALSE, backgroundColor="white", xtitle="Dose (mg)", ytitle="length", mainTitle="Plot of length \n by dose")# Customized stripchart with notched box plot# Remove grid; Remove Top and right border around the plotggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', groupColors=c('#999999','#E69F00','#56B4E9'), showLegend=FALSE, backgroundColor="white", xtitle="Dose (mg)", ytitle="length", mainTitle="Plot of length \n by dose", addBoxplot=TRUE, notch=TRUE, removePanelGrid=TRUE,removePanelBorder=TRUE, axisLine=c(0.5, "solid", "black"))# Customized stripchart, change point color, # fill box plot accoording to the groups#Change the color of points to "black"ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', groupColors=c('#999999','#E69F00','#56B4E9'), showLegend=FALSE, backgroundColor="white", xtitle="Dose (mg)", ytitle="length", mainTitle="Plot of length \n by dose", addBoxplot=TRUE, boxplotFill=NULL, notch=TRUE, colour="black")

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (34)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (35)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (36)

# Customized stripchart, add box plot, pink fill color.# Change the color of points to "black"ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', groupColors=c('#999999','#E69F00','#56B4E9'), showLegend=FALSE, backgroundColor="white", xtitle="Dose (mg)", ytitle="length", mainTitle="Plot of length \n by dose", addBoxplot=TRUE, boxplotFill="pink", colour="black")# Customized stripchart, add box plot, #fill box plot accoording to the groups.ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='dose', groupColors=c('#999999','#E69F00','#56B4E9'), showLegend=FALSE, backgroundColor="white", xtitle="Dose (mg)", ytitle="length", mainTitle="Plot of length \n by dose", addBoxplot=TRUE, boxplotFill=NULL, colour="black")

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (37)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (38)

By default, box plot fill color is “white”. To change the fill color with the argument groupColors, set boxplotFill value to NULL.

The data format is :

## len supp dose## 1 4.2 VC 0.5## 2 11.5 VC 0.5## 3 7.3 VC 0.5## 11 16.5 VC 1.0## 12 16.5 VC 1.0## 13 15.2 VC 1.0## 14 17.3 VC 1.0## 15 22.5 VC 1.0## 21 23.6 VC 2.0## 22 18.5 VC 2.0## 23 33.9 VC 2.0## 24 25.5 VC 2.0## 31 15.2 OJ 0.5## 32 21.5 OJ 0.5## 33 17.6 OJ 0.5## 34 9.7 OJ 0.5## 41 19.7 OJ 1.0## 42 23.3 OJ 1.0## 43 23.6 OJ 1.0## 44 26.4 OJ 1.0## 51 25.5 OJ 2.0## 52 26.4 OJ 2.0## 53 22.4 OJ 2.0## 54 24.5 OJ 2.0
# plot of variable 'len' by xName 'dose'. The plot is colored by the groupName 'supp'# position = interval between dot plot of the same groupggplot2.stripchart(data=df, xName='dose',yName='len', groupName='supp', position=position_jitter(0.2), backgroundColor="white", groupColors=c('#999999','#E69F00')) # Change the interval between stripchart of the same group: # position = interval between dot plot of the same groupggplot2.stripchart(data=df, xName='dose',yName='len', groupName='supp', position=position_dodge(0.8), backgroundColor="white", groupColors=c('#999999','#E69F00'))# Change the interval between stripchart of the same group#position=position_dodge(0.8), add box plotggplot2.stripchart(data=df, xName='dose',yName='len', groupName='supp', position=position_dodge(0.8), backgroundColor="white", groupColors=c('#999999','#E69F00'), addBoxplot=TRUE, boxplotFill="white")

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (39)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (40)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (41)

The facet approach splits a plot into a matrix of panels. Each panel shows a different subset of the data.

Facet with one variable

#Facet according to the supp variableggplot2.stripchart(data=df, xName='dose',yName='len', groupName='supp', legendPosition="top", faceting=TRUE, facetingVarNames="supp") # Change the direction. possible values are "vertical", "horizontal".# default is vertical.ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='supp', legendPosition="top", faceting=TRUE, facetingVarNames="supp", facetingDirection="horizontal") 

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (42)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (43)

Facet with two variables

# Facet by two variables: dose and supp.# Rows are dose and columns are suppggplot2.stripchart(data=df, xName='dose',yName='len', groupName='supp', legendPosition="top", faceting=TRUE, facetingVarNames=c("dose","supp"))# Facet by two variables: reverse the order of the 2 variables# Rows are supp and columns are doseggplot2.stripchart(data=df, xName='dose',yName='len', groupName='supp', legendPosition="top", faceting=TRUE, facetingVarNames=c("supp", "dose"))

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (44)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (45)

Facet scales

By default, all the panels have the same scale (facetingScales="fixed"). They can be made independent, by setting scales to free, free_x, or free_y.

# Facet with free scalesggplot2.stripchart(data=df, xName='dose',yName='len', groupName='supp', legendPosition="top", faceting=TRUE, facetingVarNames=c("dose", "supp"), facetingScales="free")

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (46)

As you can see in the above plot, y axis have different scales in the different panels.

Facet label apperance

# Change facet text font. Possible values for the font style: #'plain', 'italic', 'bold', 'bold.italic'.ggplot2.stripchart(data=df, xName='dose',yName='len', groupName='supp', legendPosition="top", faceting=TRUE, facetingVarNames=c("dose","supp"), facetingFont=c(12, 'bold.italic', "red"))# Change the apperance of the rectangle around facet labelggplot2.stripchart(data=df, xName='dose',yName='len', groupName='supp', legendPosition="top", faceting=TRUE, facetingVarNames=c("dose","supp"), facetingRect=list(background="white", lineType="solid", lineColor="black", lineSize=1.5) )

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (47)ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (48)

Description

Plot easily a stripchart plot using easyGgplot2 R package.

usage

ggplot2.stripchart(data, xName=NULL, yName=NULL, groupName=NULL, position=position_jitter(0.2), addMean=FALSE, meanPointShape=5, meanPointSize=4, meanPointColor="black", meanPointFill="blue", addBoxplot=FALSE, boxplotFill="white", boxplotColor="black", boxplotLineWeight=0.5, groupColors=NULL, brewerPalette=NULL,...)

Arguments

ArgumentsDescriptions
datadata.frame or a numeric vector. Columns are variables and rows are observations.
xNameThe name of column containing x variable (i.e groups). Default value is NULL.
yNameThe name of column containing y variable. If yName=NULL, data should be a numeric vector.
groupNameThe name of column containing group variable. This variable is used to color plot according to the group.
positionThe position adjustment to use for overlapping points. Default value is position_jitter(0.2).
addMeanif TRUE, the mean point is added on the plot for each group. Default value is FALSE.
meanPointShape, meanPointSizeThe shape and size of mean point.
meanPointColorborder color of the mean point. Default value is “black”.
meanPointFillFill color of mean point. This parameter is used only when meanPointShape=21 to 25. Default value is “blue”
addBoxplotif TRUE, box plot is added on the stripchart. Default value is FALSE.
boxplotFillFill color of the box plot. Default value is white.
dotPositionPossible values are “center” and “jitter”. Default value is “center”.
boxplotColorBox plot line color. Default value is black.
boxplotLineWeightBox plot line weight. Default value is 0.5.
groupColorsColor of groups. groupColors should have the same length as groups.
brewerPaletteThis can be also used to indicate group colors. In this case the parameter groupColors should be NULL. e.g: brewerPalette=“Paired”.
….Other arguments passed on to ggplot2.customize custom function or to geom_jitter and to geom_boxplot functions from ggplot2 package.

The other arguments which can be used are described at this link : ggplot2 customize. They are used to customize the plot (axis, title, background, color, legend, ….) generated using ggplot2 or easyGgplot2 R package.

Examples

df <- ToothGrowthggplot2.stripchart(data=df, xName='dose',yName='len', mainTitle="Plot of length according\n to the dose", xtitle="Dose (mg)", ytitle="Length")#Or use thisplot<-ggplot2.stripchart(data=df, xName='dose',yName='len')plot<-ggplot2.customize(plot, mainTitle="Plot of length according\n to the dose", xtitle="Dose (mg)", ytitle="Length")print(plot)

ggplot2.jitter can be also used instead of ggplot2.stripchart.

Note that an eBook is available on easyGgplot2 package here.

By Alboukadel Kassambara

Copyright 2014 Alboukadel Kassambara. All rights reserved.

Published by STHDA (http://www.sthda.com/english).

September 2014 : First edition.

Licence : This document is under creative commons licence (http://creativecommons.org/licenses/by-nc-sa/3.0/).

Contact : Alboukadel Kassambara alboukadel.kassambara@gmail.com

This analysis was performed using R (ver. 3.1.0), easyGgplot2 (ver 1.0.0) and ggplot2 (ver 1.0.0).

ggplot2.stripchart : Easy one dimensional scatter plot using ggplot2 and R software - Easy Guides - Wiki (2024)
Top Articles
Latest Posts
Article information

Author: Melvina Ondricka

Last Updated:

Views: 6170

Rating: 4.8 / 5 (48 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Melvina Ondricka

Birthday: 2000-12-23

Address: Suite 382 139 Shaniqua Locks, Paulaborough, UT 90498

Phone: +636383657021

Job: Dynamic Government Specialist

Hobby: Kite flying, Watching movies, Knitting, Model building, Reading, Wood carving, Paintball

Introduction: My name is Melvina Ondricka, I am a helpful, fancy, friendly, innocent, outstanding, courageous, thoughtful person who loves writing and wants to share my knowledge and understanding with you.