Skip to content

Commit 08e66a8

Browse files
committed
Add alt text to figures
1 parent c786e73 commit 08e66a8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

vignettes/perform_mr.Rmd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ length(p1)
170170

171171
Lines are drawn for each method used in `mr(dat)`, the slope of the line corresponding to the estimated causal effect. To limit which lines are drawn, simply specify the desired methods, e.g., to only draw the lines for the MR Egger and IVW causal effect estimates:
172172

173-
```{r}
173+
```{r fig.alt="A scatter plot visualising the two-sample data points and the following fitted models; Inverse Variance Weighted and MR-Egger.", fig.asp=1.15}
174174
res <- mr(dat, method_list = c("mr_egger_regression", "mr_ivw"))
175175
p1 <- mr_scatter_plot(res, dat)
176176
p1[[1]]
@@ -228,7 +228,7 @@ mr_leaveoneout(dat, method = mr_egger_regression)
228228

229229
Asymmetry in a funnel plot is useful for gauging the reliability of a particular MR analysis. Funnel plots can be produced using the single SNP results as follows:
230230

231-
```{r fig.alt="A funnel plot showing the causal effect for each SNP and the inverse variance weighted and MR-Egger estimates using all the SNPs.", fig.asp=1.15}
231+
```{r fig.alt="A funnel plot showing the causal effect for each SNP and the inverse variance weighted and MR-Egger estimates using all the SNPs.", fig.asp=1.15, fig.height=7}
232232
p4 <- mr_funnel_plot(res_single)
233233
p4[[1]]
234234
```
@@ -272,7 +272,7 @@ rm(list = ls()[ls() %in% "evalinr"])
272272
load(system.file("extdata", "forestplot_1_to_many_data.RData", package = "TwoSampleMR"))
273273
```
274274

275-
```{r}
275+
```{r fig.alt="A forest plot showing the estimated causal effects for each risk factor on the outcome."}
276276
min(exp(res$b - 1.96*res$se)) # identify value for 'lo' in forest_plot_1_to_many
277277
max(exp(res$b + 1.96*res$se)) # identify value for 'up' in forest_plot_1_to_many
278278
@@ -295,7 +295,7 @@ forest_plot_1_to_many(
295295

296296
It is also possible to add additional columns and column titles and to choose the size of the text in the columns:
297297

298-
```{r}
298+
```{r fig.alt="A forest plot showing the estimated causal effects for each risk factor on the outcome including columns for the no. SNPs and p-value."}
299299
res$pval <- formatC(res$pval, format = "e", digits = 2)
300300
301301
forest_plot_1_to_many(
@@ -323,7 +323,7 @@ forest_plot_1_to_many(
323323

324324
In my own workflow I prefer to to keep the plot free of axis and column titles and to add them separately in a program like Powerpoint:
325325

326-
```{r}
326+
```{r fig.alt="A forest plot showing the estimated causal effects for each risk factor on the outcome including columns for the no. SNPs and p-value without column headers."}
327327
forest_plot_1_to_many(
328328
res,
329329
b = "b",
@@ -364,7 +364,7 @@ res <-
364364
)
365365
```
366366

367-
```{r}
367+
```{r fig.alt="A forest plot showing the estimated causal effects for each method for each risk factor on the outcome."}
368368
forest_plot_1_to_many(
369369
res,
370370
b = "b",
@@ -387,7 +387,7 @@ forest_plot_1_to_many(
387387

388388
In this next example we plot the same results as above but with results stratified by a grouping variable. We also select one MR method for each unique exposure-outcome combination and sort the results by decreasing effect size within each group (i.e. largest effect at the top).
389389

390-
```{r}
390+
```{r fig.alt="Forest plot split by a subcategory variable."}
391391
res <- mr(dat2)
392392
res <- split_exposure(res)
393393
res <- subset_on_method(res)

0 commit comments

Comments
 (0)