Skip to content

Commit

Permalink
geom_smooth: method & se + position dodge2
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Apr 18, 2024
1 parent 04c8994 commit f86b3bd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ importFrom(shinyWidgets,hideDropMenu)
importFrom(shinyWidgets,numericInputIcon)
importFrom(shinyWidgets,numericRangeInput)
importFrom(shinyWidgets,pickerInput)
importFrom(shinyWidgets,prettyCheckbox)
importFrom(shinyWidgets,prettyCheckboxGroup)
importFrom(shinyWidgets,prettyRadioButtons)
importFrom(shinyWidgets,prettySwitch)
Expand Down
23 changes: 20 additions & 3 deletions R/module-controls-geoms.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#'
#' @importFrom utils head
#' @importFrom htmltools tagList tags
#' @importFrom shinyWidgets radioGroupButtons colorPickr virtualSelectInput
#' @importFrom shinyWidgets radioGroupButtons colorPickr virtualSelectInput prettyCheckbox
controls_geoms_ui <- function(id, style = NULL) {

ns <- NS(id)
Expand Down Expand Up @@ -132,6 +132,21 @@ controls_geoms_ui <- function(id, style = NULL) {
value = 0.95,
step = 0.01,
width = "100%"
),
prettyRadioButtons(
inputId = ns("method"),
label = i18n("Smoothing method:"),
choices = c("loess", "lm", "gam"),
selected = "loess",
status = "primary",
outline = TRUE,
inline = TRUE
),
prettyCheckbox(
inputId = ns("se"),
label = i18n("Display confidence interval around smooth"),
value = TRUE,
status = "primary"
)
),
tags$div(
Expand Down Expand Up @@ -177,7 +192,7 @@ controls_geoms_ui <- function(id, style = NULL) {
prettyRadioButtons(
inputId = ns("position"),
label = i18n("Position:"),
choices = c("stack", "dodge", "fill"),
choices = c("stack", "dodge", "dodge2", "fill"),
inline = TRUE,
selected = "stack",
status = "primary",
Expand Down Expand Up @@ -232,7 +247,9 @@ controls_geoms_server <- function(id,
color_ribbon = input$color_ribbon,
shape = if (!identical(input$shape, "circle")) input$shape,
span = if (!identical(input$span, 0.75)) input$span,
level = if (!identical(input$level, 0.95)) input$level
level = if (!identical(input$level, 0.95)) input$level,
method = if (!identical(input$method, "loess")) input$method,
se = input$se
))
})

Expand Down
2 changes: 2 additions & 0 deletions inst/geomIcon/iconGeom.R
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ png(filename = "inst/geomIcon/www/gg-text.png", bg = "transparent")
ggplot(data = coord_circle(centre = c(0, 0), r = 1)) + geom_polygon(aes(x = x, y = y), fill = "#CD2EFB") + coord_fixed() + theme_void()
p <- ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars))) +
geom_text(color = "white", size = 9) +
xlim(0, 8) +
ylim(7, 40) +
theme_void()
print(p, vp = viewport(width = unit(0.8, "npc"), height = unit(0.8, "npc")))
dev.off()
Expand Down

0 comments on commit f86b3bd

Please sign in to comment.