Notched box plots

Here is some simple code on doing Notched box plots. If you want to read more about notched box plots see Notched Box Plots

Notes Read 1st:

  1. lines with # in front is for your information and will be ignored by R.

  2. You will need make a dir on your C drive named R.

  3. You will need to save the attached spreadsheet to that dir.

#SIMPLE CODE

#set the dir to where you mydata is

setwd("c:/R")

#Load your mydata. The mydata is in a spreadsheet named nd-spreadsheet and we are going to call it mydata in R. NOTE a copy of the data is attached below on this web page.

mydata <- read.table("MCNP-Rain-pH.csv", header=TRUE, sep=",",)

#makes the notched box plot. "mydata" = the name of the mydata in R.

boxplot(mydata, notch=TRUE,

# Gives the title and axis names

main="Mammoth Cave National Park Rainfall pH", xlab="Years", ylab="axis label = pH",

#Sets the colors

col=(c("gold","darkgray", "darkorchid1", "cyan", "white", "red","limegreen", "magenta", "chartreuse1", "hotpink1")))

# Done

Some other useful inforation

require(datasets)

boxplot(USJudgeRatings,

horizontal = TRUE, # sets the plot horz like a distribution curve.

notch = TRUE,

col = "gray",

ylim = c(0,10), #limits / set range of y

boxwex = 0.5, #sets with bo box

whisklty = 1, #sets line type

staplelty = 4, #sests wisker type

outpch = 16, #sets the outlier sype

outcol = "Red",#sets the outlier color

xlab = "Lawyers' Ratings")