@@ -3,7 +3,6 @@ library(dplyr)
33library(ggplot2 )
44library(webshot )
55library(htmlwidgets )
6- library(shinythemes )
76library(wordcloud2 )
87
98# ### Helper Functions ####
@@ -50,7 +49,7 @@ generate_bar_chart <- function(data, column) {
5049
5150 # generate the plot
5251 ggplot(df , aes(x = reorder(word , - freq ), y = freq )) +
53- geom_bar(stat = " identity" , fill = " steelblue " ) +
52+ geom_bar(stat = " identity" , fill = " #556b2f " ) +
5453 theme_minimal() +
5554 labs(title = paste(" Counts of the Top Selections" , column ),
5655 x = column ,
@@ -70,11 +69,15 @@ url <- "https://www.pnwherbaria.org/data/getdataset.php?File=UBC_Fungi_Native.zi
7069# ### UI ####
7170
7271ui <- fluidPage(
73- theme = shinytheme(" cerulean" ),
74- titlePanel(" UBC Fungi Native Dataset Summary" ),
72+ includeCSS(" www/theme.css" ),
73+ fluidRow(
74+ column(2 , img(src = " fungi_image.png" , height = 80 )),
75+ column(10 , h2(" UBC Fungi Native Dataset Summary" ))
76+ ),
7577
7678 sidebarLayout(
7779 sidebarPanel(
80+ class = " sidebar" ,
7881 helpText(" Filter the dataset using one or more of the following columns" ),
7982 br(),
8083 textInput(" occurrence_id" , " Search by OccurenceID:" , " " ),
@@ -91,6 +94,7 @@ ui <- fluidPage(
9194
9295 ),
9396 mainPanel(
97+ class = " main-content" ,
9498 tabsetPanel(
9599 id = " tabset1" ,
96100 tabPanel(
@@ -112,7 +116,7 @@ ui <- fluidPage(
112116 column(4 ,
113117 selectInput(
114118 " visual_column" ,
115- " Choose column for word cloud :" ,
119+ " Choose column:" ,
116120 choices = c(" Genus" , " SpecificEpithet" ))
117121 ),
118122 column(4 ,
@@ -270,14 +274,14 @@ server <- function(input, output) {
270274
271275 temp_file <- tempfile(fileext = " .html" )
272276 data <- filter_data()
273- generate_word_cloud(data , input $ visual_column )
274- file.copy (temp_file , file )
277+ saveWidget( generate_word_cloud(data , input $ visual_column ), file = temp_file , selfcontained = TRUE )
278+ webshot (temp_file , file = file , vwidth = 800 , vheight = 600 , cliprect = " viewport " )
275279
276280 } else if (input $ viz_type == " Bar Chart" ) {
277281
278282 png(file )
279283 data <- filter_data()
280- generate_bar_chart(data , input $ visual_column )
284+ print( generate_bar_chart(data , input $ visual_column ) )
281285 dev.off()
282286
283287 }
0 commit comments