<div dir="ltr">Para umidade do solo eu geralmente a função de paleta de cores tim.colors() do pacote fields.<div><br></div><div><br></div><div>require(fields) # para paleta tim.colors()<br></div><div><div>library(repmis) # reads text data directly from dropbox - no need to download any file</div><div><br></div><div># read data</div><div>url <- '<a href="https://dl.dropboxusercontent.com/u/27700634/precip.txt">https://dl.dropboxusercontent.com/u/27700634/precip.txt</a>'<br></div><div>tmp <- repmis::source_data(url, sep = '', header = TRUE)</div><div><br></div><div># convert julian day to date</div><div>date <- as.Date(tmp$julian, origin='2011-12-31')</div><div>data <- cbind(date, tmp)</div><div>head(data)</div><div># define vector with depth of soil layers</div><div>depths <- c(0.05,0.10,0.20,0.30,</div><div> 0.40,0.60,0.80,1.00,</div><div> 1.50,2.00,2.50)</div><div>## colunas de interesse na ordem adequada para plot do perfil</div><div>cols <- ncol(data):4</div><div><br></div><div># Plot soil moisture profile</div><div># como são profundidades (abaixo da superfície) use a convenção de z negativo </div><div># acrescentei a chuva, precisa ajustar ylabels, mtext() resolve</div><div>x11()</div><div>nl <- 32</div><div>op <- par(mar = c(3,4,12,3))</div><div>plot <- filled.contour(date, sort(-depths), as.matrix(data[, cols]), </div><div> ylab = expression(theta(m^3~~m^-3)), </div><div> col = rev(tim.colors(nl))</div><div> )</div><div>par(new=T,mar=c(23,4,1,8))</div><div> with(data,</div><div> plot(date, precip, type = "h", xaxt = "n", xpd = T, xaxs="i", ylab = "Precip (mm)", xlab = ""))</div><div>par(op)</div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-09-18 11:46 GMT-03:00 Wenceslau Teixeira <span dir="ltr"><<a href="mailto:wgt007@gmail.com" target="_blank">wgt007@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Caros colegas do R,<br><br>muito bacana o script disponibilizado para traçar os perfis de umidade do solo. <br>Será útil para nós. Só gostaria de trocar as cores, com valores mais alto (umido) para azul e valores mais baixos (solo seco)<br>para vermelho, assim o gráfico fica mais cognitivo. <br>Alguém sabe como mudar as cores ?<br><br></div>Cordialmente,<br><br>Wenceslau Teixeira<br>Embrapa Solos<br><br><div><div><br><br>library(repmis) # reads text data directly from dropbox - no need to download any file<br># read data<br>url <- '<a href="https://dl.dropboxusercontent.com/u/27700634/precip.txt" target="_blank">https://dl.dropboxusercontent.com/u/27700634/precip.txt</a>'<br>tmp <- repmis::source_data(url, sep = '', header = TRUE)<br><br># convert julian day to date<br>date <- as.Date(tmp$julian, origin='2011-12-31')<br>data <- cbind(date, tmp)<br>head(data)<br># define vector with depth of soil layers<br>depths <- c(0.05,0.10,0.20,0.30,<br> 0.40,0.60,0.80,1.00,<br> 1.50,2.00,2.50)<br><br># teste com lattice<br>cols <- ncol(data):4<br>levelplot(as.matrix(data[, cols]),<br> aspect = "fill", xlab = "date", ylab = "soil Moist.",<br> scales = list(x = list(at = which(date %in% pretty(date)),<br> labels = pretty(date)),<br> y = list(at = length(cols):1, labels = depths)),<br> contour = T)<br><br># Plot soil moisture profile<br><br># como são profundidades (abaixo da superfície) use a convenção de z negativo<br># acrescentei a chuva, precisa ajustar ylabels, mtext() resolve<br><br>x11()<br>op <- par(mar = c(3,4,12,3))<br>plot <- filled.contour(date, sort(-depths), as.matrix(data[, cols]), ylab = expression(theta(m^3~~m^-3)))<br>par(new=T,mar=c(23,4,1,8))<br>with(data,<br> plot(date, precip, type = "h", xaxt = "n", xpd = T, xaxs="i", ylab = "Precip (mm)", xlab = ""))<br>par(op)<span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div dir="ltr"><br>Wenceslau Teixeira<br><br><a href="mailto:wgt007@gmail.com" target="_blank">wgt007@gmail.com</a><br>skype: wgt007<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div>
</font></span></div></div></div>
<br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div><font style="font-family:arial">###############################################################</font><br><span style="font-family:arial;font-size:small">## </span><span style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Jônatan Dupont Tatsch</span></div><div><span style="font-family:arial;font-size:small">## </span><span style="color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10.909090995788574px;line-height:12.997159004211426px;text-align:center;background-color:rgb(239,239,239)">Professor do Departamento de Física</span><font face="arial" style="font-size:small"><br></font></div><div><span style="font-size:small;font-family:arial">## </span><span style="color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10.909090995788574px;line-height:12.997159004211426px;text-align:center;background-color:rgb(239,239,239)">Centro de Ciências Exatas e Naturais (CCNE)</span><br></div><div><span style="font-size:small;font-family:arial">## </span><span style="color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10.909090995788574px;line-height:12.997159004211426px;text-align:center;background-color:rgb(239,239,239)">Universidade Federal de Santa Maria</span></div><div><span style="font-family:arial;font-size:small">## </span><span style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Faixa de Camobi, Prédio 13 - Campus UFSM - </span><span style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Santa Maria, RS, Brasil - 97105-900</span><br></div><div style="font-family:arial;font-size:small">## <span style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Telefone: +55(55)33012083</span><br></div><div style="font-family:arial;font-size:small">## <span style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px"><a href="http://www.ufsm.br/meteorologia" target="_blank">www.ufsm.br/meteorologia</a></span></div><div style="font-family:arial;font-size:small">###############################################################</div></div>
</div>