]> git.angelumana.com Git - liftboard/.git/commitdiff
add fivethirtyeight theme to some plots origin/feat/plot-theme
authoribidyouadu <angel.d.umana@gmail.com>
Thu, 3 Feb 2022 02:26:49 +0000 (21:26 -0500)
committeribidyouadu <angel.d.umana@gmail.com>
Thu, 3 Feb 2022 02:26:49 +0000 (21:26 -0500)
global.R
liftboard.Rproj [new file with mode: 0644]
server.R

index 83e39f03f5caf37e3843da8a5128b20ba615d646..2483cfc08dfb563c20d843ef52332fd059867cf5 100644 (file)
--- a/global.R
+++ b/global.R
@@ -4,6 +4,7 @@ library(dplyr)
 library(tidyr)
 library(readr)
 library(fmsb)
+library(ggthemes)
 
 lifts <- read_csv('data/lifts.csv')
 lifts <- rename(lifts, Weight = `Weight (lbs)`)
diff --git a/liftboard.Rproj b/liftboard.Rproj
new file mode 100644 (file)
index 0000000..8e3c2eb
--- /dev/null
@@ -0,0 +1,13 @@
+Version: 1.0
+
+RestoreWorkspace: Default
+SaveWorkspace: Default
+AlwaysSaveHistory: Default
+
+EnableCodeIndexing: Yes
+UseSpacesForTab: Yes
+NumSpacesForTab: 2
+Encoding: UTF-8
+
+RnwWeave: Sweave
+LaTeX: pdfLaTeX
index 6dcacbd286ca3621f3172874909d3aab312f7447..7ae158673439a4ba479301deed678edff08eb081 100644 (file)
--- a/server.R
+++ b/server.R
@@ -20,18 +20,23 @@ shinyServer(function(input, output) {
     
     output$exercises_plot <- renderPlot({
         if (input$metric == 'Sets') {
-            ggplot(data = setsData()) +
+            p <- ggplot(data = setsData()) +
                 geom_bar(mapping = aes(x=Exercise, weight=Sets),
                          fill = '#00aaaa',
                          color = 'black') +
                 ylab('Sets')
         } else {
-        ggplot(data = selectedData()) +
+        p <- ggplot(data = selectedData()) +
             geom_bar(mapping = aes(x=Exercise, weight=!!sym(input$metric)),
                      fill = '#00aaaa',
                      color = 'black') +
             ylab(input$metric)
-        }})
+        }
+        
+        p + 
+            theme_fivethirtyeight() +
+            theme(axis.text.x = element_text(angle = 30, hjust=1))
+    })
     
     sumBreakdown <- reactive({
         if(input$metric == 'Sets') {
@@ -90,7 +95,8 @@ shinyServer(function(input, output) {
     output$history_plot <- renderPlot({
         ggplot(data = historyData(), mapping = aes(x=Date, y=!!sym(input$metric))) +
             geom_line() +
-            geom_point()
+            geom_point() +
+            theme_fivethirtyeight()
     })
 })