<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div class=""><div class=""></div></div></div><br class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><br class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">Am 24.05.2018 um 21:54 schrieb Emerson M. Del Ponte <<a href="mailto:delponte@ufv.br" class="">delponte@ufv.br</a>>:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">No problem! but I am curious to see the plot, can you send a link?<div class=""><br class=""></div><div class=""><br clear="all" class=""><div class=""><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div style="word-wrap: break-word;" class=""><br class=""></div><div style="word-wrap: break-word;" class=""><font face="arial, helvetica, sans-serif" size="2" class="">Emerson Medeiros Del Ponte </font></div><div style="word-wrap: break-word;" class=""><font face="arial, helvetica, sans-serif" size="2" class="">Associate Professor & Graduate Studies Chair</font></div><div style="word-wrap: break-word;" class=""><font face="arial, helvetica, sans-serif" size="2" class="">Departamento de Fitopatologia, Universidade Federal de Viçosa</font></div><div style="word-wrap: break-word;" class=""><font face="arial, helvetica, sans-serif" size="2" class="">Viçosa MG Brasil  +55 (31) 3899-1103</font></div><div style="word-wrap: break-word;" class=""><font face="arial, helvetica, sans-serif" size="2" class="">-------------------------------------------------------------</font></div><div style="word-wrap: break-word;" class=""><font face="arial, helvetica, sans-serif" size="2" class="">Editor in Chief for Tropical Plant Pathology</font></div><div style="word-wrap: break-word;" class=""><font face="arial, helvetica, sans-serif" size="2" class=""><a href="http://www.sbfitopatologia.org/tpp" target="_blank" class="">www.sbfitopatologia.org/tpp</a></font></div><div style="word-wrap: break-word;" class=""><font face="arial, helvetica, sans-serif" size="2" class="">@TropPlantPathol</font></div><div style="word-wrap: break-word;" class=""><font face="georgia, serif" size="2" class=""><br class=""></font></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><br class=""><br class=""></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">Em qui, 24 de mai de 2018 às 16:51, Moritz Tobiasch <<a href="mailto:moritztobiasch@gmail.com" class="">moritztobiasch@gmail.com</a>> escreveu:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes. Wolfgang is right about everything, and in addition, I forgot to mention that the log transform command needs the {scales} package. So please <br class="">
- avoid my mistakes and follow Wolfgangs suggestions<br class="">
- load the scales package by adding library(scales) first<br class="">
- accept my sincerest apologies<br class="">
<br class="">
Cheers<br class="">
Moritz <br class="">
<br class="">
> Am 24.05.2018 um 21:38 schrieb Emerson M. Del Ponte <<a href="mailto:delponte@ufv.br" target="_blank" class="">delponte@ufv.br</a>>:<br class="">
> <br class="">
> Dear Moritz<br class="">
> <br class="">
> As a ggplot user, I tried to use your code and got the same issues as<br class="">
> Wolfgang. Can you send a fully reproducible code and the link to see the<br class="">
> plot that you obtained using your code?<br class="">
> <br class="">
> Cheers,<br class="">
> Emerson<br class="">
> <br class="">
> <br class="">
> Emerson Medeiros Del Ponte<br class="">
> Associate Professor & Graduate Studies Chair<br class="">
> Departamento de Fitopatologia, Universidade Federal de Viçosa<br class="">
> Viçosa MG Brasil  +55 (31) 3899-1103<br class="">
> -------------------------------------------------------------<br class="">
> Editor in Chief for Tropical Plant Pathology<br class="">
> <a href="http://www.sbfitopatologia.org/tpp" rel="noreferrer" target="_blank" class="">www.sbfitopatologia.org/tpp</a><br class="">
> @TropPlantPathol<br class="">
> <br class="">
> <br class="">
> <br class="">
> <br class="">
> <br class="">
> <br class="">
> <br class="">
> <br class="">
> Em qui, 24 de mai de 2018 às 15:49, Viechtbauer, Wolfgang (SP) <<br class="">
> <a href="mailto:wolfgang.viechtbauer@maastrichtuniversity.nl" target="_blank" class="">wolfgang.viechtbauer@maastrichtuniversity.nl</a>> escreveu:<br class="">
> <br class="">
>> Dear Moritz,<br class="">
>> <br class="">
>> Thanks for the code. Unfortunately, it doesn't work for me. One problem<br class="">
>> are the curly quotes (“) that R won't like. Also, 'sizex' needs to be<br class="">
>> defined first. But after fixing that, this can't work. If I run:<br class="">
>> <br class="">
>> ggplot(plot.dat, aes(ablat, exp(yi)))<br class="">
>> + geom_point(pch = 19, cex = 1.5 * sizex)<br class="">
>> <br class="">
>> then this is interpreted as two separate commands. This would work:<br class="">
>> <br class="">
>> ggplot(plot.dat, aes(ablat, exp(yi))) +<br class="">
>> geom_point(pch = 19, cex = 1.5 * sizex)<br class="">
>> <br class="">
>> Then I also got:<br class="">
>> <br class="">
>> Error in log_trans() : could not find function "log_trans"<br class="">
>> <br class="">
>> At that point, I kind of gave up.<br class="">
>> <br class="">
>> Best,<br class="">
>> Wolfgang<br class="">
>> <br class="">
>> -----Original Message-----<br class="">
>> From: R-sig-meta-analysis [mailto:<br class="">
>> <a href="mailto:r-sig-meta-analysis-bounces@r-project.org" target="_blank" class="">r-sig-meta-analysis-bounces@r-project.org</a>] On Behalf Of Moritz Tobiasch<br class="">
>> Sent: Tuesday, 22 May, 2018 23:01<br class="">
>> To: <a href="mailto:r-sig-meta-analysis@r-project.org" target="_blank" class="">r-sig-meta-analysis@r-project.org</a><br class="">
>> Subject: [R-meta] meta-regression scatterplot in ggplot2: code<br class="">
>> <br class="">
>> Dear metafor community,<br class="">
>> <br class="">
>> I recently had the very honour to dig through R code in order to set up a<br class="">
>> meta-regression scatterplot in ggplot2. As this experience was …<br class="">
>> interesting for me, but doesn’t warrant to be repeated by anyone else, I<br class="">
>> allow myself to send my approach to this honorable mailing list, for<br class="">
>> further use as deemed appropriate. @Wolfgang Viechtbauer: of course you may<br class="">
>> add this code (if it seems worth it) to your code examples on<br class="">
>> <a href="http://www.metafor-project.com/" rel="noreferrer" target="_blank" class="">www.metafor-project.com</a>.<br class="">
>> <br class="">
>> Calculations are closely based on and expand the example of a<br class="">
>> meta-analytic scatterplot as shown on the website<br class="">
>> <a href="http://www.metafor-project.org/doku.php/plots:meta_analytic_scatterplot" rel="noreferrer" target="_blank" class="">http://www.metafor-project.org/doku.php/plots:meta_analytic_scatterplot</a><br class="">
>> <br class="">
>> In order to gain access to all necessary parameters, confidence interval<br class="">
>> boundaries are extracted from the escalc() function by<br class="">
>> plot.dat <- summary.escalc(dat)<br class="">
>> which generates a data.table() with effect size yi, variance vi, standard<br class="">
>> error and confidence interval boundaries <a href="http://ci.lb/" rel="noreferrer" target="_blank" class="">ci.lb</a> and ci.ub.<br class="">
>> <br class="">
>> The data can then be put in the ggplot() syntax as following:<br class="">
>> <br class="">
>> ggplot(plot.dat, aes(ablat, exp(yi)))<br class="">
>> + geom_point(pch = 19, cex = 1.5 * sizex) # as, to my experience, ggplot()<br class="">
>> will render dots smaller than the plot() function<br class="">
>> + geom_linerange(aes(ymin = exp(plot.dat$<a href="http://ci.lb/" rel="noreferrer" target="_blank" class="">ci.lb</a>), ymax =<br class="">
>> exp(plot.dat$ci.ub)), size = .25) # gives straight lines w/o brackets at<br class="">
>> the ends. if „classical“ look is preferred, use geom_errorbar()<br class="">
>> + scale_y_continuous(trans = log_trans(), limits = c(0.2, 1.6)) # for<br class="">
>> adjustment of axes, see (as example) <a href="http://www.cookbook-r.com/Graphs/" rel="noreferrer" target="_blank" class="">http://www.cookbook-r.com/Graphs/</a><br class="">
>> + xlab("Absolute Latitude“)<br class="">
>> + ylab("risk ratio“)<br class="">
>> + geom_hline(yintercept = 1, linetype = "dotted“) # draws the dotted line<br class="">
>> at y = 1 for equal risk ratio<br class="">
>> + geom_line(data = preds, aes(x = preds$ablat, y = preds$pred)) # plots<br class="">
>> the regression line<br class="">
>> + geom_line(data = preds, aes(x = preds$ablat, y = preds$<a href="http://ci.lb/" rel="noreferrer" target="_blank" class="">ci.lb</a>), linetype<br class="">
>> = "dashed“) # plots the lower confidence interval boundary<br class="">
>> + geom_line(data = preds, aes(x = preds$ablat, y = preds$ci.ub), linetype<br class="">
>> = "dashed“) # plots the upper confidence interval boundary<br class="">
>> <br class="">
>> Labeling of individual data points was not in the scope of my work, but<br class="">
>> could be done by the geom_text(aes(label = label)) command.<br class="">
>> <br class="">
>> Hope this helps.<br class="">
>> <br class="">
>> Cheers<br class="">
>> Moritz<br class="">
>> <br class="">
>> --<br class="">
>> Dr. med. Moritz Tobiasch<br class="">
>> <br class="">
>> Kirchgasse 22b<br class="">
>> A-6020 Innsbruck<br class="">
>> Austria<br class="">
>> <br class="">
>> Tel.: +43 650 5667954<br class="">
>> <a href="mailto:moritztobiasch@gmail.com" target="_blank" class="">moritztobiasch@gmail.com</a><br class="">
>> _______________________________________________<br class="">
>> R-sig-meta-analysis mailing list<br class="">
>> <a href="mailto:R-sig-meta-analysis@r-project.org" target="_blank" class="">R-sig-meta-analysis@r-project.org</a><br class="">
>> <a href="https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis" rel="noreferrer" target="_blank" class="">https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis</a><br class="">
>> <br class="">
> <br class="">
>    [[alternative HTML version deleted]]<br class="">
> <br class="">
> _______________________________________________<br class="">
> R-sig-meta-analysis mailing list<br class="">
> <a href="mailto:R-sig-meta-analysis@r-project.org" target="_blank" class="">R-sig-meta-analysis@r-project.org</a><br class="">
> <a href="https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis" rel="noreferrer" target="_blank" class="">https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""><div class="">
<div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; line-height: normal; border-spacing: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">--</div><div class="">Dr. Moritz Tobiasch</div><div class=""><br class=""></div><div class="">Kirchgasse 22b</div><div class="">A-6020 Innsbruck</div><div class="">Österreich</div><div class=""><br class=""></div><div class="">Tel.: +43 650 5667954</div><div class=""><a href="mailto:moritztobiasch@gmail.com" class="">moritztobiasch@gmail.com</a></div><div class=""><br class=""></div></div></span><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br class=""></div></div></div></div></blockquote></div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">--</div><div class="">Dr. Moritz Tobiasch</div><div class=""><br class=""></div><div class="">Kirchgasse 22b</div><div class="">A-6020 Innsbruck</div><div class="">Österreich</div><div class=""><br class=""></div><div class="">Tel.: +43 650 5667954</div><div class=""><a href="mailto:moritztobiasch@gmail.com" class="">moritztobiasch@gmail.com</a></div><div class=""><br class=""></div></div></span><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br class=""></div></body></html>