Skip to content

Instantly share code, notes, and snippets.

@sebastiansauer
Created July 19, 2016 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebastiansauer/586e042735812eceee642f03e9abf00a to your computer and use it in GitHub Desktop.
Save sebastiansauer/586e042735812eceee642f03e9abf00a to your computer and use it in GitHub Desktop.
logistic (sigmoid) curve with ggplot2
library(ggplot2)
# library(cowplot)
library(dplyr)
logist <- function(x){
y = exp(x) / (1 + exp(x))
}
p1 <- ggplot(data_frame())
p1 + stat_function(aes(-5:5), fun = logist) + xlab("x")
@toshi-ara
Copy link

stats::plogis can be used.

p1 + stat_function(aes(-5:5), fun = plogis) + xlab("x")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment