Skip to content
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

Closed
nilsreiter opened this issue Mar 21, 2018 · 4 comments
Closed

Report for plays with many characters #84

nilsreiter opened this issue Mar 21, 2018 · 4 comments
Assignees
Labels
report Issues related to one of the reports
Milestone

Comments

@nilsreiter
Copy link
Member

Reported charts become unreadable if many characters appear

@nilsreiter nilsreiter added the report Issues related to one of the reports label Mar 21, 2018
@nilsreiter nilsreiter self-assigned this Mar 21, 2018
@t-lini
Copy link

t-lini commented May 8, 2018

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

@nilsreiter
Copy link
Member Author

nilsreiter commented May 8, 2018

summarize missing characters as 'others'

this is probably a good idea

@nilsreiter
Copy link
Member Author

Would be ok if the report generally only includes the top n characters, but it needs to be written somewhere.

@nilsreiter
Copy link
Member Author

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.

@nilsreiter nilsreiter reopened this May 25, 2018
@nilsreiter nilsreiter added this to the 2.1.0 milestone May 25, 2018
nilsreiter added a commit that referenced this issue May 25, 2018
nilsreiter added a commit that referenced this issue May 25, 2018
* features/report/many-characters-84:
  UI improvment
  more documentation
  finetuning the visuals
  more documentation
  fixed table #84
  Utterance positions now shown for all characters and limited #84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
report Issues related to one of the reports
Projects
None yet
Development

No branches or pull requests

2 participants