Home‎ > ‎Schedule‎ > ‎

Demo: plotting

novice = read.table('novice.txt',header=T)
expert = read.table('expert.txt',header=T)
# rbind combines two dataframes "by row", that is,
# one on top of the other
both = rbind(novice,expert)
# we select only half of the data frame, where
# suggestions to the annotator were 'bl', as everything else repeats
both = both[both$Suggest=="bl",]

# we can use the dependent variable in xtabs, after all.
# without a dependent variable, we get the count of items
xtabs(~Anno+Select,data=both)
# with a dependent variable, we get the time (which is the dependent variable)
# summed for each condition
xtabs(Time~Anno+Select,data=both)

# we have the same amount of sequential, random, and active learning data
# for both the novice and the expert annotator
mosaicplot(xtabs(~Anno+Select,data=both))
# but the novice took more time
mosaicplot(xtabs(Time~Anno+Select,data=both))
# labeling accuracy was pretty similar for the two annotators,
# at least so similar that it doesn't come out in the mosaic plot
mosaicplot(xtabs(SgRoundLabelAcc~Anno+Select,data=both))

# plot two panels at once
par(mfrow=c(1,2))

# This plots total morphemes versus cumulated accuracy
# the plot character changes based on the selection method,
# and the color changes based on who the annotator was.
# Note the use of "unclass" to map factors to numbers,
# which are then used to index plot characters and colors.
# Yellow is the novice, blue is the expert.
#
# character 24--triangle-- is "seq", character 22--box-- is "rand", character 21--circle-- is "al".
plot(both[c("TotalMorphs","AccAll")],pch=c(21,22,24)[unclass(both$Select)],bg=c("yellow","blue")[unclass(both$Anno)])

plot(both[c("CumulativeTime","AccAll")],pch=c(21,22,24)[unclass(both$Select)],bg=c("yellow","blue")[unclass(both$Anno)])

# plot only one panel
par(mfrow=c(1,1))

plot(both[c("CumulativeTime","TotalMorphs")],pch=c(21,22,24)[unclass(both$Select)],bg=c("yellow","blue")[unclass(both$Anno)])

par(mfrow=c(1,2))

plot(both$Time,both$Morphs,pch=c(21,22,24)[unclass(both$Select)],bg=c("yellow","blue")[unclass(both$Anno)])

plot(log(both$Time),log(both$Morphs),pch=c(21,22,24)[unclass(both$Select)],bg=c("yellow","blue")[unclass(both$Anno)])

par(mfrow=c(1,1))

# This shows that as time went on (cumulative time), each annotator became faster (time for individual items)
plot(both[c("CumulativeTime","Time")],pch=c(21,22,24)[unclass(both$Select)],bg=c("yellow","blue")[unclass(both$Anno)])
# Including a smoother to make the trend clearer
lines(smooth.spline(both[both$Anno=="novice"&both$CumulativeTime>0,c("CumulativeTime","Time")],df=5),lwd = 4, col = "yellow")
lines(smooth.spline(both[both$Anno=="expert"&both$CumulativeTime>0,c("CumulativeTime","Time")],df=5),lwd = 4, col = "blue")

library(lattice)
bwplot(Time~Select|Anno,data=both)
bwplot(Morphs~Select|Anno,data=both)
bwplot(SgRoundLabelAcc~Select|Anno,data=both)
bwplot(Time/Morphs~Select|Anno,data=both)

Comments