I know how to add a linear trend line using the lm
and abline
functions, but how do I add other trend lines, such as, logarithmic, exponential, and power trend lines?
相关问题
- R - Quantstart: Testing Strategy on Multiple Equit
- Using predict with svyglm
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
- split data frame into two by column value [duplica
相关文章
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- ess-rdired: I get this error “no ESS process is as
- How to use doMC under Windows or alternative paral
- dyLimit for limited time in Dygraphs
- Saving state of Shiny app to be restored later
- How to insert pictures into each individual bar in
A
ggplot2
approach usingstat_smooth
, using the same data as thelatemailYou could also fit the exponential trend line as using
glm
with a log link functionFor a bit of fun, you could use
theme_excel
from the ggthemesHere's one I prepared earlier:
Add a descriptive legend:
Result:
A generic and less long-hand way of plotting the curves is to just pass
x
and the list of coefficients to thecurve
function, like: