title: R: How to plot gumbel distribution using ggplot2's stat_function
body: <p>Please bear with me if this is rather tenuous, and feel free to ask questions if I have left anything out...</p>
  
  <p>I'm attempting to do some 50 year extreme wind calculations based on the following link </p>
  
  <p><a href="http://www.wasp.dk/Products/weng/ExtremeWinds.htm" rel="noreferrer">http://www.wasp.dk/Products/weng/ExtremeWinds.htm</a></p>
  
  <p>They seem to use the gumbel distribution, so I have used function gumbel in package "evir" to fit the distribution to the data, and function dgumbel in package "evd" as the plotting function.</p>
  
  <pre><code>package("evd")
  package("evir")
  
  speeds2 &lt;- data.frame(speed=sample(10:50,1000,rep=TRUE))
  gumbel(speeds2$speed)
  </code></pre>
  
  <p>I have then tried to plot this using ggplot2's stat_function, like so (except for now I have put in dummy values for loc and scale.</p>
  
  <pre><code>library(ggplot2)
  ggplot(data=speeds2, aes(x=speed)) + 
    stat_function(fun=dgumbel, args=list(loc=1, scale=0.5))
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>Error in dgev(x, loc = loc, scale = scale, shape = 0, log = log) : 
    unused argument(s) (loc = loc, scale = scale, shape = 0, log = log)
  </code></pre>
  
  <p>I am unsure if I am doing this the right way. Any pointers would be much appreciated.</p>