From db335fa822fe7bd36dbdece7e465aa2abf2ce19d Mon Sep 17 00:00:00 2001 From: Marko Lipka Date: Sun, 23 Aug 2020 23:06:42 +0200 Subject: [PATCH 1/3] ignore rsconnect (and other files) --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 5b6a065..482b80f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ .Rproj.user +.Rproj .Rhistory .RData .Ruserdata +rsconnect/ +.gitignore From c2f1c4c7242f4aea5501ab909e3b5ef3d482a0b2 Mon Sep 17 00:00:00 2001 From: Marko Lipka Date: Mon, 24 Aug 2020 01:36:39 +0200 Subject: [PATCH 2/3] - manually define breaks for geom_contour() and geom_label_contour() via pretty(), as breaks are not pretty when chosen by geom_label_contour() (fixes #1) - add sliderInput() to define number of contours in plot --- Shiny_carb_plot.Rmd | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Shiny_carb_plot.Rmd b/Shiny_carb_plot.Rmd index f258311..d6a3641 100644 --- a/Shiny_carb_plot.Rmd +++ b/Shiny_carb_plot.Rmd @@ -64,14 +64,17 @@ inputPanel( selectInput(inputId = "parameter", label = "dependent parameter", choices = c("ALK", "DIC", "fCO2", "fCO2insitu", "fCO2pot", - "HCO3", "OmegaAragonite", "OmegaCalcite", "pCO2", "pCO2insitu", "pCO2pot", "pH")) + "HCO3", "OmegaAragonite", "OmegaCalcite", "pCO2", "pCO2insitu", "pCO2pot", "pH")), + sliderInput(inputId = "bins", + label = "number of bins in plot", + min = 3, max = 42, value = 11) ) renderPlot({ carb.data() %>% ggplot(aes_string(x = "co2", y = "co3", z = input$parameter)) + - geom_contour(size = 1) + - metR::geom_label_contour() + + geom_contour(size = 1, breaks = pretty(carb.data()[, input$parameter], n = input$bins)) + + metR::geom_label_contour(breaks = pretty(carb.data()[, input$parameter], n = input$bins)) + scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) + theme_light() + From fe15d69f3167277e88a432c808e06d8da57ba9c3 Mon Sep 17 00:00:00 2001 From: Marko Lipka Date: Mon, 24 Aug 2020 02:09:19 +0200 Subject: [PATCH 3/3] - rotated geom_text_contour() with stroke instead of geom_label_contour() - disable 0-expand-limitation in scale_x_continous() to fix #3 - theme_miniumal() instead of theme_light() - bigger plot --- Shiny_carb_plot.Rmd | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Shiny_carb_plot.Rmd b/Shiny_carb_plot.Rmd index d6a3641..e1f450f 100644 --- a/Shiny_carb_plot.Rmd +++ b/Shiny_carb_plot.Rmd @@ -74,12 +74,13 @@ renderPlot({ carb.data() %>% ggplot(aes_string(x = "co2", y = "co3", z = input$parameter)) + geom_contour(size = 1, breaks = pretty(carb.data()[, input$parameter], n = input$bins)) + - metR::geom_label_contour(breaks = pretty(carb.data()[, input$parameter], n = input$bins)) + - scale_x_continuous(expand = c(0, 0)) + + metR::geom_text_contour(breaks = pretty(carb.data()[, input$parameter], n = input$bins), + rotate = TRUE, stroke = 0.3) + + #scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) + - theme_light() + + theme_minimal() + theme(text = element_text(size = 20)) -}) +}, width = 1000, height = 700) ```