Pixelated (not-smooth) curve in geom_function

Viewed 373

How can I smoothen the chart line using ggplot2

I am trying to plot a graph for this function

exposure_funct_0.25 <- function(x) {
  exp(-0.25*x)
} 

exposure_funct_0.5 <- function(x) {
  exp(-0.5*x)
} 

 ggplot(data.frame(x = c(0,15)), aes(x=x)) + 
         geom_function( fun = exposure_funct_0.25, linetype = 2 )  + 
        geom_function(fun = exposure_funct_0.5, linetype = 1)

However, the code resulted in "broken lines" chart like this :

enter image description here

I tried to add +geom_smooth() but this one does not seem to work with my situation. Specifying n= 201 or higher does not help, unfortunately.

Is there any way to make the line smooth like this smoothened line?

0 Answers
Related