Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier contour-labels, variable number of contour lines #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.Rproj.user
.Rproj
.Rhistory
.RData
.Ruserdata
rsconnect/
.gitignore
16 changes: 10 additions & 6 deletions Shiny_carb_plot.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,23 @@ 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() +
scale_x_continuous(expand = c(0, 0)) +
geom_contour(size = 1, breaks = pretty(carb.data()[, input$parameter], n = input$bins)) +
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)

```

Expand Down