[R-br] erro no scale_x_continuous
joão Rodrigo Castro
joaorodrigo2005 em gmail.com
Terça Fevereiro 16 00:51:35 BRST 2016
Pessoal,
Um erro que acredito ser no scale_x_continuous está gerando um erro no
gráfico. Ao reproduzirem o script, vejam que os valores no gráfico não
correspondem aos valores referentes aos fatores county e value.
Script:
############
library(ggplot2)
library(reshape2)
library(grid)
this_base = "Indice de concordancia"
my_data = data.frame(
modelos = c("BC", "CD", "DB", "HG1", "HG2"),
Alegrete = c(0.75,0.77,0.76,0.72,0.78),
Bage = c(0.80,0.82,0.79,0.76,0.81),
Camaqua = c(0.72,0.76,0.73,0.78,0.77),
Cangucu = c(0.68,0.70,0.68,0.76,0.73),
Dom_Pedrito = c(0.812,0.829,0.812,0.845,0.831),
Enc._do_Sul = c(0.457,0.751,0.741,0.785,0.749),
Jaguarao = c(0.742,0.775,0.722,0.815,0.821),
Mostardas = c(0.510,0.423,0.135,0.590,0.506),
Pelotas = c(0.739,0.760,0.745,0.773,0.741),
Porto_Alegre = c(0.778,0.801,0.773,0.808,0.800),
Quarai = c(0.8008,0.8205,0.8052,0.8210,0.8095),
Rio_Grande = c(0.591,0.598,0.382,0.725,0.734),
Rio_Pardo = c(0.803,0.818,0.780,0.830,0.805),
Santiago= c(0.779,0.778,0.763,0.800,0.760),
Sao_Borja= c(0.755,0.777,0.756,0.804,0.782),
Sao_Gabriel= c(0.812,0.829,0.811,0.849,0.831),
Sao_Luiz_Gonzaga= c(0.770,0.778,0.766,0.805,0.756),
Sant._Livramento= c(0.803,0.805,0.801,0.817,0.777),
Santa_V_Palmar= c(0.619,0.588,0.385,0.710,0.702),
Santa_Maria= c(0.721,0.753,0.685,0.775,0.764),
Torres= c(0.544,0.595,0.306,0.603,0.621),
Tramandai= c(0.461,0.483,0.111,0.561,0.544),
Uruguaiana= c(0.801,0.811,0.782,0.818,0.795))
my_data_long = melt(my_data, id = "modelos",
variable.name = "county", value.name = "Indice c")
my_data_long$county = factor(
c("Alegrete", "Bage", "Camaqua", "Cangucu", "Dom Pedrito",
"Enc. do Sul", "Jaguarao", "Mostardas", "Pelotas",
"Porto Alegre", "Quarai", "Rio Grande","Rio Pardo",
"Santiago","Sao Borja","Sao Gabriel",
"S.L. Gonzaga","S. Livramento",
"St.V. Palmar","Santa Maria","Torres",
"Tramandai","Uruguaiana"))
my_data_long$modelos =
factor(my_data_long$modelos,
rev(c("BC", "CD", "DB", "HG1", "HG2")))
p <- ggplot(my_data_long, aes(x = value*10, y = modelos)) +
geom_point() +
facet_wrap(~ county, ncol = 4)
#scale_x_continuous(breaks = c(0,0.5,1),labels = c( 0,0.6,0.9)) +
labs(x = "Indice de concordancia", y = NULL)
ggtitle("Indice de concordancia c") +
theme_bw()
theme(panel.grid.major.y = element_line(colour = "grey60"),
panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
panel.margin = unit(0, "lines"),
plot.title = element_text(size = rel(1.1), face = "bold", vjust =
2),
strip.background = element_rect(fill = "grey80"),
axis.ticks.y = element_blank())
p
ggsave(paste(this_base, ".png"),
p, width = 6, height = 8)
################
Acredito que seja no argumento break, sinceramente não consegui
desenvolver..
sds
--
João Rodrigo de Castro
Programa de Pós-Graduação em Meteorologia
Bolsista Laboratório de Agrometeorologia - Embrapa Clima Temperado
Universidade Federal de Pelotas
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20160215/87b81b9a/attachment.html>
Mais detalhes sobre a lista de discussão R-br