New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report for plays with many characters #84
Comments
possible fixes: scale font size and create more than one plot for 'all utterance' and 'utterance length variation' graphs, limit 'configuration and copresence' graphs to specified number of characters and summarize missing characters as 'others' (extend color palette?), limit networks to specified number of characters, create more than one plot for word fields graphs |
this is probably a good idea |
Would be ok if the report generally only includes the top n characters, but it needs to be written somewhere. |
For the configuration-like charts, the following snippet might help: data(rksp.0)
rksp0 <- rksp.0$mtext
c <- configuration(rksp0)
c$matrix <- scale(c$matrix, center=FALSE, scale=colSums(c$matrix))
rownames(c$matrix) <- c$figure
b <- barplot(c$matrix,
legend.text=c$figure, # set legend text
args.legend = list(cex=0.5, # legend font size
x=7.5, # legend x position
y=max(colSums(c$matrix)) # legend y pos
),
col=qd.colors)
getLabels <- function(x,b,limit=100) {
rl <- apply(x, 2, function(xx) {
xx <- as.double(xx)
cs <- c(0,head(cumsum(xx),-1))
r <- cs + xx/2
r[xx<=limit] <- NA
r
})
rl
}
#print(getLabels(c$matrix,b,limit=0.1))
labelPositions <- as.vector(getLabels(c$matrix,b,limit=0.1))
br <- rep(b,each=nrow(c$matrix))
ns <- rep(as.character(c$figure),ncol(c$matrix))
br <- br[which(!is.na(labelPositions))]
ns <- ns[which(!is.na(labelPositions))]
labelPositions <- labelPositions[which(!is.na(labelPositions))]
text(x=br,y=labelPositions,labels=ns) This way we can get rid of the legend entirely by showing character names in the bar plot. |
Reported charts become unreadable if many characters appear
The text was updated successfully, but these errors were encountered: