twoway.barplot: Draw a two-way barplot and add significant letters onto the...

View source: R/twoway.barplot.R

twoway.barplotR Documentation

Draw a two-way barplot and add significant letters onto the bars automatically

Description

The function could be used as drawing two-way barplot and adding letters representing significant difference automatically. Same uppercase and lowercase denote non-significant difference between factor levels (x axis) for each of group levels and between group levels (group) for each of factor levels (x axis).

Usage

twoway.barplot(dat, x.factor = "x.factor",  response = "response", group = "group", method = 'HSD.test',maximum=NULL, minmum=NULL, legend=TRUE, sig.letters=NULL, legend.pos='topright',group.name=group,italic.on=FALSE, ...)

Arguments

dat

a dataframe.

x.factor

a category variable at the x axis.

response

a contineous response variable.

group

a group variable at the y axis.

method

one of multiple contrast approach in HSD.test, duncan.test, LSD.test etc in agricolae package. The default is Tukey HSD.test.

maximum

a parameter which modifies the positions of letters denote significance among groups in figure.

minmum

a parameter which modifies the lowest y range.

legend

default is TRUE, legend can be canceled by argument legend=FALSE

sig.letters

a matrix on letters denoting different significance between level and treatment

legend.pos

a legend position.

group.name

a group name on legend text.

italic.on

a switch to control whether italic font for group.level in legend.

...

further arguments pass to bargraph.CI function.

Examples

data(leaflife, package = 'smatr')
twoway.barplot(dat=leaflife,x.factor='rain',group='soilp',response='lma')

twoway.barplot(dat=leaflife,x.factor='rain',group='soilp',response='lma',xlab='Rainfall', ylab=~LMA~(kg~m^-2))

twoway.barplot(dat=leaflife,x.factor='rain',group='soilp',response='lma',xlab='Rainfall', ylab=~LMA~(kg~m^-2),italic.on=TRUE)

twoway.barplot(dat=leaflife,x.factor='rain',group='soilp',response='lma',group.name='Soil P',
	       xlab='Rainfall', ylab=~LMA~(kg~m^-2))


liuguofang/figsci documentation built on Nov. 24, 2023, 1:45 p.m.