[MediaWiki-commits] [Gerrit] analytics...WDCM[master]: Debug Crosstabs ggrepel w. facet_wrap
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/381058 ) Change subject: Debug Crosstabs ggrepel w. facet_wrap .. Debug Crosstabs ggrepel w. facet_wrap Change-Id: I1a26c631900c412e70196533af87be876153e60b --- M WDCM_UsageDashboard/server.R M WDCM_UsageDashboard/ui.R 2 files changed, 21 insertions(+), 14 deletions(-) Approvals: GoranSMilovanovic: Verified; Looks good to me, approved jenkins-bot: Verified diff --git a/WDCM_UsageDashboard/server.R b/WDCM_UsageDashboard/server.R index 74f8a9f..8cded77 100644 --- a/WDCM_UsageDashboard/server.R +++ b/WDCM_UsageDashboard/server.R @@ -18,17 +18,13 @@ library(reshape2) ### --- compute library(parallelDist) -library(smacof) ### --- visualization -library(wordcloud) library(RColorBrewer) library(visNetwork) -library(rbokeh) library(networkD3) library(ggplot2) library(ggrepel) library(scales) -library(ggvis) ### --- Server (Session) Scope ### @@ -784,8 +780,6 @@ selProj <- projectOrder$Project[1:25] plotFrame <- plotFrame %>% filter(Project %in% selProj) -plotFrame$Project <- factor(plotFrame$Project, - levels = selProj) # - express labels as K, M: plotFrame$Label <- sapply(plotFrame$Usage, function(x) { if (x >= 1e+03 & x < 1e+06) { @@ -797,17 +791,19 @@ } return(out) }) +plotFrame$Project <- factor(plotFrame$Project, +levels = selProj) # - Plot ggplot(plotFrame, aes(x = Project, y = Usage, label = Label)) + geom_line(size = .25, color = "#4c8cff", group = 1) + geom_point(size = 1.5, color = "#4c8cff") + geom_point(size = 1, color = "white") + - geom_text_repel(aes(label = plotFrame$Label), + geom_text_repel(data = plotFrame, + aes(x = Project, y = Usage, label = Label), size = 3) + facet_wrap(~ Category, ncol = 3, scales = "free_y") + xlab('Project') + ylab('Entity Usage') + - ylim(0, max(plotFrame$Usage) + .5*max(plotFrame$Usage)) + scale_y_continuous(labels = comma) + theme_minimal() + theme(axis.text.x = element_text(angle = 90, size = 12, hjust = 1)) + @@ -868,7 +864,8 @@ geom_line(size = .25, color = "#4c8cff", group = 1) + geom_point(size = 1.5, color = "#4c8cff") + geom_point(size = 1, color = "white") + - geom_text_repel(aes(label = plotFrame$Label), + geom_text_repel(data = plotFrame, + aes(x = `Project Type`, y = Usage, label = Label), size = 3) + facet_wrap(~ Category, ncol = 3, scales = "free_y") + xlab('Project Type') + ylab('Entity Usage') + diff --git a/WDCM_UsageDashboard/ui.R b/WDCM_UsageDashboard/ui.R index af91400..2eea3fb 100644 --- a/WDCM_UsageDashboard/ui.R +++ b/WDCM_UsageDashboard/ui.R @@ -134,6 +134,7 @@ ), fluidRow( column(width = 12, + br(), br(), htmlOutput('categoryItems_overview_Title'), HTML("Note: In the absence of English item label the Wikidata item ID is used in place of it."), @@ -162,6 +163,7 @@ ), fluidRow( column(width = 12, + br(), br(), HTML('Wikidata item usage per semantic category in each project type Note: Item usage count is given on a logarithmic scale.'), br(), br(), @@ -201,6 +203,7 @@ ), fluidRow( column(width = 12, +
[MediaWiki-commits] [Gerrit] analytics...WDCM[master]: Debug Crosstabs ggrepel w. facet_wrap
GoranSMilovanovic has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/381058 ) Change subject: Debug Crosstabs ggrepel w. facet_wrap .. Debug Crosstabs ggrepel w. facet_wrap Change-Id: I1a26c631900c412e70196533af87be876153e60b --- M WDCM_UsageDashboard/server.R M WDCM_UsageDashboard/ui.R 2 files changed, 21 insertions(+), 14 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/analytics/wmde/WDCM refs/changes/58/381058/1 diff --git a/WDCM_UsageDashboard/server.R b/WDCM_UsageDashboard/server.R index 74f8a9f..8cded77 100644 --- a/WDCM_UsageDashboard/server.R +++ b/WDCM_UsageDashboard/server.R @@ -18,17 +18,13 @@ library(reshape2) ### --- compute library(parallelDist) -library(smacof) ### --- visualization -library(wordcloud) library(RColorBrewer) library(visNetwork) -library(rbokeh) library(networkD3) library(ggplot2) library(ggrepel) library(scales) -library(ggvis) ### --- Server (Session) Scope ### @@ -784,8 +780,6 @@ selProj <- projectOrder$Project[1:25] plotFrame <- plotFrame %>% filter(Project %in% selProj) -plotFrame$Project <- factor(plotFrame$Project, - levels = selProj) # - express labels as K, M: plotFrame$Label <- sapply(plotFrame$Usage, function(x) { if (x >= 1e+03 & x < 1e+06) { @@ -797,17 +791,19 @@ } return(out) }) +plotFrame$Project <- factor(plotFrame$Project, +levels = selProj) # - Plot ggplot(plotFrame, aes(x = Project, y = Usage, label = Label)) + geom_line(size = .25, color = "#4c8cff", group = 1) + geom_point(size = 1.5, color = "#4c8cff") + geom_point(size = 1, color = "white") + - geom_text_repel(aes(label = plotFrame$Label), + geom_text_repel(data = plotFrame, + aes(x = Project, y = Usage, label = Label), size = 3) + facet_wrap(~ Category, ncol = 3, scales = "free_y") + xlab('Project') + ylab('Entity Usage') + - ylim(0, max(plotFrame$Usage) + .5*max(plotFrame$Usage)) + scale_y_continuous(labels = comma) + theme_minimal() + theme(axis.text.x = element_text(angle = 90, size = 12, hjust = 1)) + @@ -868,7 +864,8 @@ geom_line(size = .25, color = "#4c8cff", group = 1) + geom_point(size = 1.5, color = "#4c8cff") + geom_point(size = 1, color = "white") + - geom_text_repel(aes(label = plotFrame$Label), + geom_text_repel(data = plotFrame, + aes(x = `Project Type`, y = Usage, label = Label), size = 3) + facet_wrap(~ Category, ncol = 3, scales = "free_y") + xlab('Project Type') + ylab('Entity Usage') + diff --git a/WDCM_UsageDashboard/ui.R b/WDCM_UsageDashboard/ui.R index af91400..2eea3fb 100644 --- a/WDCM_UsageDashboard/ui.R +++ b/WDCM_UsageDashboard/ui.R @@ -134,6 +134,7 @@ ), fluidRow( column(width = 12, + br(), br(), htmlOutput('categoryItems_overview_Title'), HTML("Note: In the absence of English item label the Wikidata item ID is used in place of it."), @@ -162,6 +163,7 @@ ), fluidRow( column(width = 12, + br(), br(), HTML('Wikidata item usage per semantic category in each project type Note: Item usage count is given on a logarithmic scale.'), br(), br(), @@ -201,6 +203,7 @@ ), fluidRow( column(width = 12, +