<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div><span></span></div><div> require(UsingR)<br>x=rnorm(999)<br>y=x+rnorm(999)<br>simple.scatterplot(x,y)<br><br><br></div><div>
<br>
<br>André Oliveira Souza</div><div style="display: block;" class="yahoo_quoted"> <br> <br> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> Em Domingo, 15 de Dezembro de 2013 15:50, Andre Oliveira <andreolsouza@yahoo.com.br> escreveu:<br> </font> </div> <div class="y_msg_container"><div id="yiv5484764690"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt;"><div><span></span></div><div> </div><div>
<br clear="none">
<br clear="none">André Oliveira Souza</div><div class="yiv5484764690yqt8552888796" id="yiv5484764690yqt91745"><div class="yiv5484764690yahoo_quoted" style="display:block;"> <br clear="none"> <br clear="none"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt;"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"> <div dir="ltr"> <font face="Arial" size="2"> Em Domingo, 15 de Dezembro de 2013 11:35, Rodrigo Coster <rcoster@gmail.com> escreveu:<br clear="none"> </font> </div> <div class="yiv5484764690y_msg_container"><div id="yiv5484764690"><div><div dir="ltr"><div><br clear="none"></div><div>Acho que tu nao entrou no link que eu falei... Enfim, segue o texto do link (<a rel="nofollow" shape="rect" target="_blank"
href="http://www.r-bloggers.com/example-10-3-enhanced-scatterplot-with-marginal-histograms/">http://www.r-bloggers.com/example-10-3-enhanced-scatterplot-with-marginal-histograms/</a>)</div>
<div><br clear="none"></div><div>scatterhist <- function(x, y, xlab = "", ylab = "", plottitle="", </div><div> xsize=1, cleanup=TRUE,...){</div><div> # save the old graphics settings-- they may be needed</div>
<div> def.par <- par(no.readonly = TRUE)</div><div> </div><div> zones <- matrix(c(1,1,1, 0,5,0, 2,6,4, 0,3,0), ncol = 3, byrow = TRUE)</div><div> layout(zones, widths=c(0.3,4,1), heights = c(1,3,10,.75))</div><div>
</div><div> # tuning to plot histograms nicely</div><div> xhist <- hist(x, plot = FALSE)</div><div> yhist <- hist(y, plot = FALSE)</div><div> top <- max(c(xhist$counts, yhist$counts))</div><div> </div><div>
# for all three titles: </div><div> # drop the axis titles and omit boxes, set up margins</div><div> par(xaxt="n", yaxt="n",bty="n", mar = c(.3,2,.3,0) +.05)</div><div> # fig 1 from the layout</div>
<div> plot(x=1,y=1,type="n",ylim=c(-1,1), xlim=c(-1,1))</div><div> text(0,0,paste(plottitle), cex=2)</div><div> # fig 2</div><div> plot(x=1,y=1,type="n",ylim=c(-1,1), xlim=c(-1,1))</div><div> text(0,0,paste(ylab), cex=1.5, srt=90)</div>
<div> # fig 3</div><div> plot(x=1,y=1,type="n",ylim=c(-1,1), xlim=c(-1,1))</div><div> text(0,0,paste(xlab), cex=1.5)</div><div> </div><div> # fig 4, the first histogram, needs different margins</div><div> # no margin on the left</div>
<div> par(mar = c(2,0,1,1))</div><div> barplot(yhist$counts, axes = FALSE, xlim = c(0, top),</div><div> space = 0, horiz = TRUE)</div><div> # fig 5, other histogram needs no margin on the bottom</div><div> par(mar = c(0,2,1,1))</div>
<div> barplot(xhist$counts, axes = FALSE, ylim = c(0, top), space = 0)</div><div> # fig 6, finally, the scatterplot-- needs regular axes, different margins</div><div> par(mar = c(2,2,.5,.5), xaxt="s", yaxt="s", bty="n")</div>
<div> # this color allows traparency & overplotting-- useful if a lot of points</div><div> plot(x, y , pch=19, col="#00000022", cex=xsize, ...)</div><div> </div><div> # reset the graphics, if desired </div>
<div> if(cleanup) {par(def.par)}</div><div>}</div><div><br clear="none"></div><div><br clear="none"></div><div>scatterhist(rnorm(1000), rchisq(1000, 7))</div><div><br clear="none"></div><div><br clear="none"></div></div><div class="yiv5484764690gmail_extra"><br clear="none"><br clear="none"><div class="yiv5484764690gmail_quote">
2013/12/15 Andre Oliveira <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:andreolsouza@yahoo.com.br" target="_blank" href="mailto:andreolsouza@yahoo.com.br">andreolsouza@yahoo.com.br</a>></span><br clear="none"><div class="yiv5484764690yqt0925121490" id="yiv5484764690yqt44046"><blockquote class="yiv5484764690gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div style="font-size:10pt;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;">Já havia buscado em meus arquivos pessoais e na internet com construir este gráfico com uma rodada só de camandos. Algo deste tipo:<br clear="none">
<br clear="none"><div><span> </span><span><span><span><span>library("Simple") </span><br clear="none"><span>data(emissions)</span><br clear="none"><span>attach(emissions)</span></span><span><span><br clear="none">
<span>simple.scatterplot(perCapita,CO2)</span><br clear="none"><span>title("GDP/capita vs. CO2 emissions 1999")</span></span></span></span></span> <br clear="none"></div><div>
<br clear="none">
Só que não deu certo aqui, parece que esta biblioteca saiu dos repositórios.<br clear="none"><br clear="none"><br clear="none"><br clear="none"></div><div style="display:block;"> <br clear="none"> <br clear="none"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt;">
<div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"> <div dir="ltr"> <font face="Arial"> Em Domingo, 15 de Dezembro de 2013 11:08, Rodrigo Coster <<a rel="nofollow" shape="rect" ymailto="mailto:rcoster@gmail.com" target="_blank" href="mailto:rcoster@gmail.com">rcoster@gmail.com</a>> escreveu:<br clear="none">
</font> </div><div><div class="yiv5484764690h5"> <div><div><div><div dir="ltr">Uma simples busca no google resulta em diversas soluções:<div><br clear="none"></div><div><a rel="nofollow" shape="rect" target="_blank" href="https://www.google.com/search?q=scatter+plot+with+histogram+r&oq=scatter+plot+with+hi&aqs=chrome.1.69i57j0l5.10330j0j7&sourceid=chrome&espv=210&es_sm=122&ie=UTF-8">https://www.google.com/search?q=scatter+plot+with+histogram+r</a><br clear="none">
</div><div><br clear="none"></div><div><br clear="none"></div><div>O 2o link é mais amigável para quem não tem 'intimidade' com o ggplot2...</div></div><div><br clear="none"><br clear="none"><div>2013/12/15 Andre Oliveira <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:andreolsouza@yahoo.com.br" target="_blank" href="mailto:andreolsouza@yahoo.com.br">andreolsouza@yahoo.com.br</a>></span><br clear="none">
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div><div style="font-size:10pt;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;"><div>
<span>Bom dia,</span></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;"><span> alguem da lsta sabe qual função do R faz este gráfico.</span></div>
<div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;"><span><a rel="nofollow" shape="rect" target="_blank" href="https://www.dropbox.com/s/iyfef9sy4tfv4r4/teste.png">https://www.dropbox.com/s/iyfef9sy4tfv4r4/teste.png</a><br clear="none">
</span></div><div> </div>obrigado <br clear="none"><br clear="none"><br clear="none"><br clear="none"></div></div></div><br clear="none">_______________________________________________<br clear="none">
R-br mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:R-br@listas.c3sl.ufpr.br" target="_blank" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br clear="none">
Leia o guia de postagem (<a rel="nofollow" shape="rect" target="_blank" href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br clear="none"></blockquote></div>
<br clear="none"></div></div></div><br clear="none"><br clear="none"></div> </div></div></div> </div> </div> </div></div></blockquote></div></div><br clear="none"></div></div></div><br clear="none"><br clear="none"></div> </div> </div> </div></div> </div></div></div><br><br></div> </div> </div> </div> </div></body></html>