Plot de Funções com ggplot 2

library(ggplot2)
library(RColorBrewer)
source("/dados/R/multiplot.R")
source("/dados/R/paletas.R")
#gasolineros
SUCA_A <- function (t) {1 - exp(-exp(1.798 - 0.137 *t))}
SUCA_COM_G <- function (t) {1 - exp(-exp(1.618 - 0.141 *t))}
SUCA_MOTO <- function (t) {1/(1 + exp(0.12*(t-5)))+1/(1 + exp(0.12*(t+5)))}
#diesel
suca <- function (t) {1/(1 + exp(a(t-t0)))+1/(1 + exp(a(t+t0)))}
#t é a idade do veículo em anos
SUCA_COM_D <- function (t) {1/(1 + exp(0.17*(t-15.3)))+1/(1 + exp(0.17*(t+15.3)))}
SUCA_CAM <- function (t) {1/(1 + exp(0.1*(t-17)))+1/(1 + exp(0.1*(t+17)))}
SUCA_ONI <- function (t) {1/(1 + exp(0.16*(t-19.1)))+1/(1 + exp(0.16*(t+19.1)))}
ggplot(NULL, aes(x=t, colour = FE)) +
  stat_function(data = data.frame(t = 1:50, FE = factor(1)),fun = SUCA_A, size=2)+
  stat_function(data = data.frame(t = 1:50, FE = factor(2)),fun = SUCA_COM_G, size=2)+
  stat_function(data = data.frame(t = 1:50, FE = factor(3)),fun = SUCA_MOTO, size=2)+  
  scale_colour_manual(values = Set2,
                    name = "Veículo",
                    labels = c("Automóvies Gasolina","Comerciais Gasolina","Motocicletas"))+
  ggtitle("Curvas de Sucateamento Veículos Ciclo Otto")+
  theme(plot.title = element_text(lineheight=1, face="bold"),
        axis.text.x=element_text(size=20, face="bold"),
        axis.text.y=element_text(size=20, face="bold"))+
  ylab("CO (g/km)")+
  xlab("Ano de edad de veículo")+
  theme(legend.position=c(.7, .7)) 

How to cite:

Plot de Funções com ggplot2. GURI Grupo de Usuários de R IAG USP. de http://www.dca.iag.usp.br/www/material/ritaynoue/aca0326/GURI/asdf.html date: (accesado 2014-12-10).