| BAG | UFV | ESALQ | 
|---|---|---|
| Soja | 80 | 69 | 
| Trigo | 200 | 42 | 
| Feijão | 183 | 125 | 
| Milho | 23 | 200 | 
# Entrada de dados
UFV<-c(80,200,183,23)
ESALQ<-c(69,42,125,200)
# Culturas
Especies<-c("Soja", "Trigo", "Feijão", "Milho")
# Múltiplas janelas
par(mfrow=c(1,2))
# Barplot
barplot(UFV, names.arg=Especies,  ylab = 'Número de acessos', 
        xlab = 'Culturas', main = 'BAG UFV')
barplot(ESALQ, names.arg=Especies,  ylab = 'Número de acessos', 
        xlab = 'Culturas', main = 'BAG ESALQ')Clima_Exp<-read.table("http://cristianetaniguti.github.io/Workshop_
                      genetica_esalq//praticas_2017/
                      Tempo_Londrina.csv",
                      header = T, sep = ";", dec = ",")
head(Clima_Exp)##   dia     Mes prec.mm       Data
## 1   1 Janeiro    51.2 2017-01-01
## 2   2 Janeiro    44.8 2017-01-02
## 3   3 Janeiro     6.8 2017-01-03
## 4   4 Janeiro     0.6 2017-01-04
## 5   5 Janeiro     4.8 2017-01-05
## 6   6 Janeiro     0.0 2017-01-06Fonte: IAPAR
summary(Clima_Exp)##       dia              Mes        prec.mm              Data    
##  Min.   : 1.0   Abril    :30   Min.   : 0.00   2017-01-01:  1  
##  1st Qu.: 8.0   Fevereiro:28   1st Qu.: 0.00   2017-01-02:  1  
##  Median :16.0   Janeiro  :31   Median : 0.00   2017-01-03:  1  
##  Mean   :15.6   Junho    :30   Mean   : 5.21   2017-01-04:  1  
##  3rd Qu.:23.0   Maio     :31   3rd Qu.: 3.60   2017-01-05:  1  
##  Max.   :31.0   Março    :31   Max.   :59.60   2017-01-06:  1  
##                                                (Other)   :175Clima_Exp$dia<-as.factor(Clima_Exp$dia)tapply(Clima_Exp$prec.mm, Clima_Exp$Mes, mean)##     Abril Fevereiro   Janeiro     Junho      Maio     Março 
##  4.653333  3.650000  8.532258  3.573333  7.406452  3.222581print(levels(Clima_Exp$Mes))## [1] "Abril"     "Fevereiro" "Janeiro"   "Junho"     "Maio"      "Março"Reordenar os fatores para mês:
Clima_Exp$Mes = factor(Clima_Exp$Mes,
                       levels(Clima_Exp$Mes)[c(3,2,6,1,5,4)])tapply(Clima_Exp$prec.mm, Clima_Exp$Mes, mean)##   Janeiro Fevereiro     Março     Abril      Maio     Junho 
##  8.532258  3.650000  3.222581  4.653333  7.406452  3.573333tapply(Clima_Exp$prec.mm, Clima_Exp$Mes, sum)##   Janeiro Fevereiro     Março     Abril      Maio     Junho 
##     264.5     102.2      99.9     139.6     229.6     107.2plot(prec.mm~Mes, data = Clima_Exp, main="Médias",
     xlab = "Meses do ano de 2017",
     ylab = "Precipitação em mm")barplot(tapply(Clima_Exp$prec.mm, Clima_Exp$Mes, sum), 
        main="Total Mensal",
        xlab = "Meses do ano de 2017",
        ylab = "Precipitação em mm")library(tidyverse)
library(ggplot2)
day=as.Date("2017-01-01") + 0:180 # 181: number of colected days
value=Clima_Exp$prec.mm
data1=data.frame(day, value)
# Calculate mean value per month
don=data1 %>% mutate(month = as.Date(cut(day, breaks = "month"))) %>%
  group_by(month) %>% 
  summarise(average = mean(value)) 
# And make the plot BY A MONTH
ggplot(don, aes(x=month, y=average)) +
  labs(title="Médias") +
  theme(plot.title = element_text(hjust = 0.5)) +
  xlab("Meses do ano de 2017") +
  ylab("Precipitação em mm") +
  geom_line() + 
  geom_point() +
  geom_area(fill=alpha('slateblue',0.2)) +
  scale_x_date(date_labels = "%W-%b", date_breaks="1 month") +
  theme(axis.text.x=element_text(angle=60, hjust=1))# Calculate agregated data per week
don=data1 %>% mutate(week = as.Date(cut(day, breaks = "week"))) %>%
  group_by(week) %>% 
  summarise(average = sum(value)) 
# And make the plot BY A week with out annotation
ggplot(don, aes(x=week, y=average)) +
  labs(title="Totais") +
  theme(plot.title = element_text(hjust = 0.5)) +
  xlab("Meses do ano de 2017") +
  ylab("Precipitação em mm") +
  geom_line() + 
  geom_point() +
  geom_area(fill=alpha('slateblue',0.2)) +
  scale_x_date(date_labels = "%W-%b", date_breaks="1 month") +
  theme(axis.text.x=element_text(angle=60, hjust=1))Clima_Long <- matrix(c(302.9,205.9,81.2,86,7.6,88.7,103.2,31.7,7,278.3,140.1,86.4,
                       201.6,40.3,87.8,159,64.5,344.2,33.1,1,65,111.1,120,232.7,
                       202.4,328.5,146.8,134.7,173.1,250.2,71.5,0,84.7,259.5,96.4,125.9,
                       148,172.2,146.2,162,96.7,65.7,102.8,19.5,176.3,9.9,148.4,234.7,
                       201.2,173.8,118.3,65,145.4,10.3,345.9,33.2,201.5,256.5,516.1,390.6,
                       417.8,308.4,131.9,79,292.9,108.5,33.8,120.7,56.2,187.8,87.3,152.1),
                     6,12,byrow=TRUE)##       [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10] [,11]
## [1,] 302.9 205.9  81.2  86.0   7.6  88.7 103.2  31.7   7.0 278.3 140.1
## [2,] 201.6  40.3  87.8 159.0  64.5 344.2  33.1   1.0  65.0 111.1 120.0
## [3,] 202.4 328.5 146.8 134.7 173.1 250.2  71.5   0.0  84.7 259.5  96.4
## [4,] 148.0 172.2 146.2 162.0  96.7  65.7 102.8  19.5 176.3   9.9 148.4
## [5,] 201.2 173.8 118.3  65.0 145.4  10.3 345.9  33.2 201.5 256.5 516.1
## [6,] 417.8 308.4 131.9  79.0 292.9 108.5  33.8 120.7  56.2 187.8  87.3Fonte: IAPAR
colnames(Clima_Long) <- c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
                          "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
rownames(Clima_Long) <- c("2011", "2012", "2013",
                          "2014", "2015", "2016")
Clima_Long##        Jan   Feb   Mar   Apr   May   Jun   Jul   Aug   Sep   Oct   Nov
## 2011 302.9 205.9  81.2  86.0   7.6  88.7 103.2  31.7   7.0 278.3 140.1
## 2012 201.6  40.3  87.8 159.0  64.5 344.2  33.1   1.0  65.0 111.1 120.0
## 2013 202.4 328.5 146.8 134.7 173.1 250.2  71.5   0.0  84.7 259.5  96.4
## 2014 148.0 172.2 146.2 162.0  96.7  65.7 102.8  19.5 176.3   9.9 148.4
## 2015 201.2 173.8 118.3  65.0 145.4  10.3 345.9  33.2 201.5 256.5 516.1
## 2016 417.8 308.4 131.9  79.0 292.9 108.5  33.8 120.7  56.2 187.8  87.3
##        Dec
## 2011  86.4
## 2012 232.7
## 2013 125.9
## 2014 234.7
## 2015 390.6
## 2016 152.1library(lattice)
library(hydroTSM)
print(matrixplot(Clima_Long, ColorRamp="Precipitation", 
                 main="Precipitação Média em Londrina
                 - PR [mm/mês/ano]"))rm(list=ls())
Feijão <- read.table("http://cristianetaniguti.github.io/Workshop_
                     genetica_esalq//praticas_2017/
                     Feijao_Magno.csv", header = TRUE,
                     sep = ";", dec = ",", na.strings = TRUE)
head(Feijão) ##   Cultivar  Local Bloco Produtividade
## 1        1 Lavras     1          1000
## 2        2 Lavras     1           800
## 3        3 Lavras     1           700
## 4        4 Lavras     1           920Fonte: Ramalho et al. 2012
summary(Feijão)##     Cultivar               Local        Bloco   Produtividade   
##  Min.   : 1.0   Lavras        :30   Min.   :1   Min.   : 120.0  
##  1st Qu.: 3.0   Patos de Minas:30   1st Qu.:1   1st Qu.: 327.5  
##  Median : 5.5                       Median :2   Median : 600.0  
##  Mean   : 5.5                       Mean   :2   Mean   : 608.5  
##  3rd Qu.: 8.0                       3rd Qu.:3   3rd Qu.: 832.5  
##  Max.   :10.0                       Max.   :3   Max.   :1090.0Feijão$Cultivar <- as.factor(Feijão$Cultivar)
Feijão$Bloco <- as.factor(Feijão$Bloco)summary(Feijão)##     Cultivar             Local    Bloco  Produtividade   
##  1      : 6   Lavras        :30   1:20   Min.   : 120.0  
##  2      : 6   Patos de Minas:30   2:20   1st Qu.: 327.5  
##  3      : 6                       3:20   Median : 600.0  
##  4      : 6                              Mean   : 608.5  
##  5      : 6                              3rd Qu.: 832.5  
##  6      : 6                              Max.   :1090.0  
##  (Other):24str(Feijão)## 'data.frame':    60 obs. of  4 variables:
##  $ Cultivar     : Factor w/ 10 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ...
##  $ Local        : Factor w/ 2 levels "Lavras","Patos de Minas": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Bloco        : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Produtividade: int  1000 800 700 920 820 980 1020 600 620 930 ...Fonte: P. Stephen et al.
Feijão.Lavras<- subset(Feijão, Feijão$Local=='Lavras')
Feijão.Patos<- subset(Feijão, Feijão$Local=='Patos de Minas')
summary(Feijão.Lavras)##     Cultivar             Local    Bloco  Produtividade   
##  1      : 3   Lavras        :30   1:10   Min.   : 600.0  
##  2      : 3   Patos de Minas: 0   2:10   1st Qu.: 725.0  
##  3      : 3                       3:10   Median : 845.0  
##  4      : 3                              Mean   : 844.3  
##  5      : 3                              3rd Qu.: 970.0  
##  6      : 3                              Max.   :1090.0  
##  (Other):12Média dos dados para Lavras:
tapply(Feijão.Lavras$Produtividade, Feijão.Lavras$Local, mean)##         Lavras Patos de Minas 
##       844.3333             NAComo resolver? (equivalente ao as.factor)
Feijão.Lavras = transform(Feijão.Lavras, Cultivar = factor(Cultivar),
                          Bloco = factor(Bloco),
                          Local = factor(Local))
Feijão.Patos = transform(Feijão.Patos, Cultivar = factor(Cultivar),
                         Bloco = factor(Bloco),
                         Local = factor(Local))
tapply(Feijão.Lavras$Produtividade, Feijão.Lavras$Local, mean)##   Lavras 
## 844.3333Gerando o croqui (mapa de campo) dos experimentos:
1 - Definindo os tratamentos
Cultivar<- c("1","2","3","4","5","6","7","8","9","10") #ou
Cultivar<-c(levels(Feijão$Cultivar)) #já temos os dados2 - Definindo os número de blocos e/ou repetições
Blocos<-c(3) 3 - Gerar o croqui (sorteio)/Mapa de campo
require(agricolae)
Croqui_Lavras<-design.rcbd(Cultivar, seed = 1, Blocos, first=TRUE)$book
Croqui_Patos<-design.rcbd(Cultivar, seed = 2, Blocos, first=FALSE)$bookCroqui_Lavras##    plots block Cultivar
## 1    101     1        4
## 2    102     1        5
## 3    103     1        8
## 4    104     1        9
## 5    105     1        7
## 6    106     1        3
## 7    107     1        2
## 8    108     1        1
## 9    109     1       10
## 10   110     1        6
## 11   201     2        4
## 12   202     2        8
## 13   203     2        3
## 14   204     2        7
## 15   205     2        1
## 16   206     2       10
## 17   207     2        5
## 18   208     2        2
## 19   209     2        9
## 20   210     2        6
## 21   301     3        1
## 22   302     3        5
## 23   303     3        6
## 24   304     3        7
## 25   305     3        2
## 26   306     3        9
## 27   307     3       10
## 28   308     3        4
## 29   309     3        3
## 30   310     3        8Croqui_Patos##    plots block Cultivar
## 1    101     1        1
## 2    102     1        2
## 3    103     1        3
## 4    104     1        4
## 5    105     1        5
## 6    106     1        6
## 7    107     1        7
## 8    108     1        8
## 9    109     1        9
## 10   110     1       10
## 11   201     2        3
## 12   202     2        1
## 13   203     2        2
## 14   204     2        5
## 15   205     2        4
## 16   206     2        9
## 17   207     2        6
## 18   208     2        8
## 19   209     2       10
## 20   210     2        7
## 21   301     3        1
## 22   302     3        4
## 23   303     3        8
## 24   304     3        3
## 25   305     3        2
## 26   306     3        5
## 27   307     3        9
## 28   308     3        6
## 29   309     3       10
## 30   310     3        7Modelo estatístico para ANAVA individual:
Formalizando…
Sendo \(k\) = 1,2…,10 e \(l\) = 1,2,3, onde:
\(Y_{kl}\) é o valor observado para a produtividade referente ao \(k-ésimo\) genótipo no \(l-ésimo\) bloco;
\(\mu\) é a média dos genótipos para o local;
\(t_{k}\) é o efeito fixo dos genótipos \(k\) no valor observado;
\(b_{l}\) é o efeito fixo do bloco \(l\); e
\(e_{ij}\) é o erro associado a observação \(y_{ij}\)
\(H_{0}\) = \(\mu_{G1}\) = \(\mu_{G2}\) = \(\mu_{G3}\) = … = \(\mu_{G10}\), com probablidade \(\alpha\) = 0.05
\(H_{A}\) = pelo menos UMA média difere das demais, com probablidade \(\alpha\) = 0.05O modelo…
… é modelado no R da seguinte maneira:
Modelo.Lavras = aov(Produtividade ~ Bloco + Cultivar, data = Feijão.Lavras)
anova(Modelo.Lavras)## Analysis of Variance Table
## 
## Response: Produtividade
##           Df Sum Sq Mean Sq F value    Pr(>F)    
## Bloco      2   1407     703  0.1159    0.8912    
## Cultivar   9 560737   62304 10.2705 1.891e-05 ***
## Residuals 18 109193    6066                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1Modelo.Patos = aov(Produtividade ~ Bloco + Cultivar, data = Feijão.Patos)
anova(Modelo.Patos)## Analysis of Variance Table
## 
## Response: Produtividade
##           Df Sum Sq Mean Sq F value    Pr(>F)    
## Bloco      2  23407   11703  4.9074    0.0199 *  
## Cultivar   9 459453   51050 21.4064 7.438e-08 ***
## Residuals 18  42927    2385                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1Como os 10 genótipos foram avaliados em dois locais, podemos efetuar a análise de variância conjunta, para diagnosticar se há interação genótipos por ambientes. Contudo, antes é preciso verificar a homogeneidade de variâncias das análises individuais. Essa situação é MUITO comum em programas de melhoramento de plantas.
1 - Teste de Hartley: Razão entre a maior e a menor variância (QMres):
6066/2385## [1] 2.543396Em geral, se H < 7, pode-se efetuar a ANAVA conjunta.
Fonte: Pimentel Gomes 1990, pág 128
Formalizando…
Em que:
\(Y_{klq}\) é o valor de produtividade observado para o genótipo \(k\) no bloco \(l\) dentro do local \(q\);
\(\mu\) é a média geral dos genótipos;
\(t_{k}\) é o efeito fixo dos genótipos \(k\);
\(a_{q}\) é o efeito do local \(q\);
\(b_{(l)q}\) é o efeito do bloco \(l\) dentro do ambiente \(q\);
\((ta)_{kq}\) é o efeito da interação genótipos \(k\) por locais \(q\); e
\(e_{(q)kl}\) é o erro experimental médio
O modelo…
… é modelado no R da seguinte maneira:
Modelo_Conj<- aov(Produtividade~Cultivar + Local + Local:Bloco +
                    Local:Cultivar, data = Feijão)
anova(Modelo_Conj)## Analysis of Variance Table
## 
## Response: Produtividade
##                Df  Sum Sq Mean Sq  F value    Pr(>F)    
## Cultivar        9  561415   62379  14.7624 1.203e-09 ***
## Local           1 3337042 3337042 789.7285 < 2.2e-16 ***
## Local:Bloco     4   24813    6203   1.4681    0.2322    
## Cultivar:Local  9  458775   50975  12.0635 1.693e-08 ***
## Residuals      36  152120    4226                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1tapply(Feijão$Produtividade, Feijão$Cultivar, mean)##        1        2        3        4        5        6        7        8 
## 768.3333 683.3333 625.0000 590.0000 546.6667 605.0000 746.6667 476.6667 
##        9       10 
## 465.0000 578.3333Faz sentido?
NÃO!
Médias_Lavras=tapply(Feijão.Lavras$Produtividade, Feijão.Lavras$Cultivar, mean)
sort(Médias_Lavras, decreasing = TRUE)##         1         6         7         4        10         2         5 
## 1046.6667  966.6667  940.0000  920.0000  910.0000  846.6667  836.6667 
##         3         8         9 
##  733.3333  633.3333  610.0000Médias_Patos=tapply(Feijão.Patos$Produtividade, Feijão.Patos$Cultivar, mean)
sort(Médias_Patos, decreasing = TRUE)##        7        2        3        1        8        9        4        5 
## 553.3333 520.0000 516.6667 490.0000 320.0000 320.0000 260.0000 256.6667 
##       10        6 
## 246.6667 243.3333Como sempre, o melhor é fazer gráficos!
par(mfrow=c(1,2))
barplot(sort(Médias_Lavras, decreasing = TRUE), 
        main = "Média dos Genótipos em Lavras",
        xlab = "Genótipos",
        ylab = "Produtividade em g/parcela",
        col = c("blue","blue","blue","red","red",
                "red","red","red","red","red"))
barplot(sort(Médias_Patos, decreasing = TRUE), 
        main = "Média dos Genótipos em Patos de Minas",
        xlab = "Genótipos",
        ylab = "Produtividade em g/parcela",
        col = c("blue","blue","blue","red","red",
                "red","red","red","red","red"))library(gridExtra)
library(ggplot2)
plot1=ggplot(Feijão.Lavras, aes(x = reorder(as.factor(Cultivar), -Produtividade),
                                y = Produtividade, fill=Cultivar)) +
  stat_summary(fun.y="mean", geom="bar") +
  labs(title="Média dos Genótipos em Lavras",
       subtitle = "Média geral em Lavras") +
  theme(plot.title = element_text(hjust = 0.5)) +
  theme(plot.subtitle = element_text(hjust = 0.5)) +
  xlab("Genótipos") +
  ylab(expression(g/parcela)) +
  theme(axis.text.x = element_text(angle=0, face="bold", colour="black")) +
  geom_hline(yintercept = mean(Feijão.Lavras$Produtividade), color="green", linetype="dashed")
plot1 = plot1 + scale_fill_manual(values=c("blue","red","red","red","red","blue","blue","red","red","red"))
plot1 = plot1 + theme(legend.position="none")
plot2=ggplot(Feijão.Patos, aes(x = reorder(as.factor(Cultivar), -Produtividade),
                               y = Produtividade, fill=Cultivar)) +
  stat_summary(fun.y="mean", geom="bar") +
  labs(title="Média dos Genótipos em Patos de Minas",
       subtitle = "Média geral em Patos de Minas") +
  theme(plot.title = element_text(hjust = 0.5)) +
  theme(plot.subtitle = element_text(hjust = 0.5)) +
  xlab("Genótipos") +
  ylab(expression(g/parcela)) +
  theme(axis.text.x = element_text(angle=0, face="bold", colour="black")) +
  geom_hline(yintercept = mean(Feijão.Patos$Produtividade), color="green", linetype="dashed")
plot2 = plot2 + scale_fill_manual(values=c("red","blue","blue","red","red","red","blue","red","red","red"))
plot2 = plot2 + theme(legend.position="none")
grid.arrange(plot1, plot2, ncol=2)require(gridExtra)
require(ggplot2)
plot1<-ggplot(Feijão.Lavras, aes(x = reorder(as.factor(Cultivar), -Produtividade),
                                 y = Produtividade)) +
  stat_summary(fun.y="mean", geom="bar") +
  labs(title="Média dos Genótipos em Lavras",
       subtitle = "Média geral em Lavras") +
  theme(plot.title = element_text(hjust = 0.5)) +
  theme(plot.subtitle = element_text(hjust = 0.5)) +
  xlab("Genótipos") +
  ylab(expression(g/parcela)) +
  theme(axis.text.x = element_text(angle=0, face="bold", colour="black")) +
  geom_hline(yintercept = mean(Feijão.Lavras$Produtividade), color="green", linetype="dashed")
plot2<-ggplot(Feijão.Patos, aes(x = reorder(as.factor(Cultivar), -Produtividade),
                                y = Produtividade)) +
  stat_summary(fun.y="mean", geom="bar") +
  labs(title="Média dos Genótipos em Patos de Minas",
       subtitle = "Média geral em Patos de Minas") +
  theme(plot.title = element_text(hjust = 0.5)) +
  theme(plot.subtitle = element_text(hjust = 0.5)) +
  xlab("Genótipos") +
  ylab(expression(g/parcela)) +
  theme(axis.text.x = element_text(angle=0, face="bold", colour="black")) +
  geom_hline(yintercept = mean(Feijão.Patos$Produtividade), color="green", linetype="dashed")
grid.arrange(plot1, plot2,ncol=2)library(gridExtra)
library(ggplot2)
plot1<-ggplot(Feijão.Lavras, aes(x = reorder(as.factor(Cultivar), -Produtividade),
                                 y = Produtividade)) +
  geom_boxplot(outlier.colour = "red", outlier.shape = 1) +
  labs(title="Média dos Genótipos em Lavras",
       subtitle = "Média geral em Lavras") +
  theme(plot.title = element_text(hjust = 0.5)) +
  theme(plot.subtitle = element_text(hjust = 0.5)) +
  xlab("Genótipos") +
  ylab(expression(g/parcela)) +
  theme(axis.text.x = element_text(angle=0, face="bold", colour="black")) +
  geom_hline(yintercept = mean(Feijão.Lavras$Produtividade), color="green", linetype="dashed")
plot2<-ggplot(Feijão.Patos, aes(x = reorder(as.factor(Cultivar), -Produtividade),
                                y = Produtividade)) +
  geom_boxplot(outlier.colour = "red", outlier.shape = 1) +
  labs(title="Média dos Genótipos em Patos de Minas",
       subtitle = "Média geral em Patos de Minas") +
  theme(plot.title = element_text(hjust = 0.5)) +
  theme(plot.subtitle = element_text(hjust = 0.5)) +
  xlab("Genótipos") +
  ylab(expression(g/parcela)) +
  theme(axis.text.x = element_text(angle=0, face="bold", colour="black")) +
  geom_hline(yintercept = mean(Feijão.Patos$Produtividade), color="green", linetype="dashed")
grid.arrange(plot1 + geom_boxplot(fill='#A4A4A4', color="darkred"), 
             plot2 + geom_boxplot(fill='#A4A4A4', color="darkred"), ncol=2)library(multcompView)
par(mfrow=c(2,1))
multcompBoxplot(Produtividade ~ Cultivar, data=Feijão.Lavras,
                compFn = "TukeyHSD", decreasing = FALSE)library(multcompView)
multcompBoxplot(Produtividade ~ Cultivar, data=Feijão.Patos,
                compFn = "TukeyHSD", decreasing = FALSE)# A line graph
ggplot(data=Feijão, aes(x=Cultivar, y=Produtividade, group=Local, shape=Local, colour=Local)) + 
  stat_summary(geom="line", fun.y="mean") +
  expand_limits(y=0) +                      
  scale_colour_hue(name="Locais", l=30)  +            
  scale_shape_manual(name="Locais", values=c(22,21)) +      
  xlab("Genótipos") + ylab("Produtividade em g/parcela") + 
  theme_bw() +
  theme(legend.position=c(.7, .15))           val=round(rnorm(2),2)
name<-c("Lavras", "Patos de Minas") 
lat<- c(-21.2457, -18.5794) #Latitude
long<-c(-44.9998, -46.5184) #Longitude
Dados.mapa<- data.frame(long, lat, val,name)
# Show a marker at each position
library(leaflet)
m=leaflet(data = Dados.mapa) %>% addTiles() %>% addMarkers(~long, ~lat, popup = ~as.character(name))
mplot(1:10, 1:10, type = "n", ann = FALSE, axes = TRUE,
     bg = "green", xaxt = "n", yaxt = "n")
texto <- substring("preciso", 1:7, 1:7)
text(seq(1.7, 2.9, by = 0.2), rep(2, 7), texto, col =
       rainbow(7), cex = 2.5)
text(5, 5, "treinar", srt = 45, cex = 2.5)
segments(1, 7.6, 3, 7.6, lty = 3, lwd = 5)
text(2, 8, "gráficos", cex = 2)
text(8, 8, "no")
rect(7.5, 7.5, 8.5, 8.5)
text(8, 5, "R", font = 4, cex = 4, col = "blue")
arrows(2.5, 2.5, 4.5, 4.5, srt = 45, code = 2, lty = 2)
arrows(4.5, 5, 2.5, 7.5, srt = 90, code = 2, lty = 1, lwd = 3)
arrows(3, 8, 7.5, 7.5, srt = 0, code = 2, lty = 1, angle = 10, len = 0.4)
arrows(8, 7.5, 8, 5.5, srt = -90, code = 2, lty = 2, len = 0.9,angle = 60)
text(8, 2, "Eu vou\n conseguir!", cex = 2, col = "red")
points(seq(7, 9, len = 10), rep(4, 10), pch = "*", col = "violet", cex = 1.5) Fonte: Adilson dos Anjos (UFPR)