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("<font size = 2><b>Note: </b>In the absence of English item label the 
Wikidata item ID 
                                                                                
                 is used in place of it.</font>"),
@@ -162,6 +163,7 @@
                                                                 ),
                                                                 fluidRow(
                                                                   column(width 
= 12,
+                                                                         br(), 
br(),
                                                                          
HTML('<b>Wikidata item usage per semantic category in each project type</b><br>
                                                                               
<font size="2"><b>Note:</b> Item usage count is given on a logarithmic 
scale.</font>'),
                                                                          br(), 
br(),
@@ -201,6 +203,7 @@
                                                                                
     ),
                                                                                
   fluidRow(
                                                                                
     column(width = 12,
+                                                                               
            br(), br(),
                                                                                
            htmlOutput('projectOverview_relativeRank_Title'),
                                                                                
            br(), br(),
                                                                                
            withSpinner(plotOutput('projectOverview_relativeRank',
@@ -211,6 +214,7 @@
                                                                                
     ),
                                                                                
   fluidRow(
                                                                                
     column(width = 12,
+                                                                               
            br(), br(),
                                                                                
            htmlOutput('projectOverview_semantics_Title'),
                                                                                
            HTML("<font size = 2><b>Note: </b>We study the distribution of 
Wikidata usage across the semantic categories to 
                                                                                
                 determine which client projects use Wikidata in a similar way. 
In this graph, each project points towards the one 
@@ -223,6 +227,7 @@
                                                                                
   ),
                                                                                
   fluidRow(
                                                                                
     column(width = 12, 
+                                                                               
            br(), br(),
                                                                                
            htmlOutput('projectOverview_topItems_Title'),
                                                                                
            HTML("<font size = 2><b>Note: </b>In the absence of English item 
label the Wikidata item ID 
                                                                                
                 is used in place of it.</font>"),
@@ -300,13 +305,15 @@
                                                                 fluidRow(
                                                                   column(width 
= 6,
                                                                          
h4('Projects'),
-                                                                         
withSpinner(plotOutput('tabulations_projectsChart', height = "600px")),
+                                                                         
withSpinner(plotOutput('tabulations_projectsChart', 
+                                                                               
                 height = "600px")),
                                                                          
downloadButton('tabulations_projectsDownload_Frame',
                                                                                
         'Data (csv)')
                                                                          ),
                                                                   column(width 
= 6,
                                                                          
h4('Categories'),
-                                                                         
withSpinner(plotOutput('tabulations_categoriesChart', height = "600px")),
+                                                                         
withSpinner(plotOutput('tabulations_categoriesChart', 
+                                                                               
                 height = "600px")),
                                                                          
downloadButton('tabulations_categoriesDownload_Frame',
                                                                                
         'Data (csv)')
                                                                   )
@@ -319,7 +326,8 @@
                                                                 fluidRow(
                                                                   column(width 
= 6,
                                                                          
h4('Project Types'),
-                                                                         
withSpinner(plotOutput('tabulations_projectTypesChart', height = "600px")),
+                                                                         
withSpinner(plotOutput('tabulations_projectTypesChart', 
+                                                                               
                 height = "600px")),
                                                                          
downloadButton('tabulations_projectTypesChart_Frame',
                                                                                
         'Data (csv)')
                                                                   ),
@@ -334,7 +342,8 @@
                                                                 fluidRow(
                                                                   column(width 
= 12,
                                                                          
h4('Project vs Categories'),
-                                                                         
withSpinner(plotOutput('crosstabulations_projectsCategoriesChart', height = 
"850px")),
+                                                                         
withSpinner(plotOutput('crosstabulations_projectsCategoriesChart', 
+                                                                               
                 height = "850px")),
                                                                          
downloadButton('crosstabulations_projectsCategoriesFrame',
                                                                                
         'Data (csv)')
                                                                          )
@@ -347,7 +356,8 @@
                                                                 fluidRow(
                                                                   column(width 
= 12,
                                                                          
h4('Project Types vs Categories'),
-                                                                         
withSpinner(plotOutput('crosstabulations_projectTypesCategoriesChart', height = 
"850px")),
+                                                                         
withSpinner(plotOutput('crosstabulations_projectTypesCategoriesChart', 
+                                                                               
                 height = "850px")),
                                                                          
downloadButton('crosstabulations_projectTypeCategoriesChartFrame',
                                                                                
         'Data (csv)')
                                                                   )

-- 
To view, visit https://gerrit.wikimedia.org/r/381058
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a26c631900c412e70196533af87be876153e60b
Gerrit-PatchSet: 1
Gerrit-Project: analytics/wmde/WDCM
Gerrit-Branch: master
Gerrit-Owner: GoranSMilovanovic <goran.milovanovic_...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to