Daniel, muito obrigado. A ideia é ótima. Vou fazer aqui. Muito obrigado!
Em ter., 2 de fev. de 2021 às 17:47, Daniel Guimarães Tiezzi <[email protected]> escreveu: > Vc teria que apresentar algo assim então: > > > png("mybarchart.png", width = 12, height = 8, units = 'in', res = 300) > par(mar=c(5.1, 4.1, 4.1, 6.1), xpd=TRUE) > barplot(t(as.matrix(df[-nrow(df),c(-1,-6)])), col = c('cornflowerblue', > "hotpink", 'lightgoldenrodyellow', 'aquamarine3'), space = 0, ylim = > c(0,30000), border = NA, xlab = 'Mês') > lines(seq(0.5,11.5),df$`2020`[-13], col = 'red', lwd = 3) > points(seq(0.5,11.5),df$`2020`[-13], col = 'red', cex = 1.45, pch = '+') > legend("topright", inset=c(-0.1,0), legend=c(colnames(df)[-1]), > title="Ano", pch = c(15,15,15,15,3), col = c('cornflowerblue', "hotpink", > 'lightgoldenrodyellow', 'aquamarine3', 'red'), bty = 'n', > lwd=c(0,0,0,0,1.5), pt.cex=c(2,2,2,2,1)) > dev.off() > > ---------------------------------------------------------------- > Daniel Tiezzi, MD, PhD > Oncologia / Mastologia > Professor Associado - Livre Docente > Departamento de Ginecologia e Obstetrícia > Setor de Mastologia e Oncologia Ginecológica > Faculdade de Medicina de Ribeirão Preto - USP > Tel.: 16 3602-2488 > https://github.com/dtiezzi > http://danieltiezzi.pro.br > e-mail: [email protected] <[email protected]> > > On 2 Feb 2021, at 12:55, Olympio Neto por (R-br) <[email protected]> > wrote: > > <image.png> > > Mas no fim, estou achando muito confuso. Talvez separados representem > melhor o objetivo. > > De qualquer forma, obrigado! > > Olympio > > Em ter., 2 de fev. de 2021 às 11:59, Daniel Guimarães Tiezzi < > [email protected]> escreveu: > >> Bom dia >> >> Seria algo assim? >> >> df <- structure(list(Mês = c("Jan", "Fev", "Mar", "Abr", "Mai", "Jun", >> "Jul", "Ago", "Set", "Out", "Nov", "Dez", "Total"), `2016` = c(209L, 3959L, >> 8668L, 5448L, 4198L, 4042L, 4602L, 6969L, 3336L, 8580L, 6036L, 352L, >> 56399L), `2017` = c(314L, 2740L, 2758L, 2424L, 4138L, 2030L, 280L, 4552L, >> 2509L, 2847L, 6322L, 179L, 31093L), `2018` = c(778L, 3968L, 3092L, 2357L, >> 1333L, 895L, 5489L, 3598L, 4072L, 5562L, 6218L, 115L, 37477L), `2019` = >> c(246L, 2353L, 2905L, 4563L, 2791L, 493L, 3197L, 6463L, 1375L, 5626L, >> 10443L, 138L, 40593L), `2020` = c(76L, 2685L, 2062L, 0L, 0L, 0L, 0L, 1408L, >> 1554L, 3831L, 4573L, 1104L, 17293L)), class = "data.frame", row.names = >> c(NA, -13L)) >> df >> >> df_s <- as.data.frame(t(df[nrow(df),-1])) >> colnames(df_s) <- 'total' >> df_s$ano <- seq(2016, 2020) >> df_s >> library(ggplot2) >> p0 <- ggplot(data = df_s, aes(y=stat(total), x = ano)) + geom_bar() + >> theme_minimal() >> p0 >> >> df_l <- df[-nrow(df), c(1,6)] >> colnames(df_l) <- c('m', 'val') >> df_l >> p1 <- ggplot(data = df_l, aes(x = m, y = val, group = 1)) + geom_line() + >> theme_minimal() >> p1 >> >> ---------------------------------------------------------------- >> Daniel Tiezzi, MD, PhD >> Oncologia / Mastologia >> Professor Associado - Livre Docente >> Departamento de Ginecologia e Obstetrícia >> Setor de Mastologia e Oncologia Ginecológica >> Faculdade de Medicina de Ribeirão Preto - USP >> Tel.: 16 3602-2488 >> https://github.com/dtiezzi >> http://danieltiezzi.pro.br >> e-mail: [email protected] <[email protected]> >> >> >> On 2 Feb 2021, at 11:07, Olympio Neto por (R-br) < >> [email protected]> wrote: >> >> structure(list(Mês = c("Jan", "Fev", "Mar", "Abr", "Mai", "Jun", >> "Jul", "Ago", "Set", "Out", "Nov", "Dez", "Total"), `2016` = c(209L, >> 3959L, 8668L, 5448L, 4198L, 4042L, 4602L, 6969L, 3336L, 8580L, >> 6036L, 352L, 56399L), `2017` = c(314L, 2740L, 2758L, 2424L, 4138L, >> 2030L, 280L, 4552L, 2509L, 2847L, 6322L, 179L, 31093L), `2018` = c(778L, >> 3968L, 3092L, 2357L, 1333L, 895L, 5489L, 3598L, 4072L, 5562L, >> 6218L, 115L, 37477L), `2019` = c(246L, 2353L, 2905L, 4563L, 2791L, >> 493L, 3197L, 6463L, 1375L, 5626L, 10443L, 138L, 40593L), `2020` = c(76L, >> 2685L, 2062L, 0L, 0L, 0L, 0L, 1408L, 1554L, 3831L, 4573L, 1104L, >> 17293L)), class = "data.frame", row.names = c(NA, -13L)) >> >> >> _______________________________________________ > R-br mailing list > [email protected] > https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br > Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça > código mínimo reproduzível. > > >
_______________________________________________ R-br mailing list [email protected] https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.
