Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I add second axis labels in ggplot2?
    primarykey
    data
    text
    <p>Building on my <a href="https://stackoverflow.com/questions/10183292/how-can-i-remove-empty-factors-from-ggplot2-facets">previous question</a> I'd like to add second axis label on the opposite side of the plot.</p> <p>The data frame looks like:</p> <pre><code>test &lt;- structure(list(characteristic = structure(c(1L, 2L, 3L, 1L, 2L ), .Label = c("Factor1", "Factor2", "Factor3"), class = "factor"), es = c(1.2, 1.4, 1.6, 1.3, 1.5), ci_low = c(1.1, 1.3, 1.5, 1.2, 1.4), ci_upp = c(1.3, 1.5, 1.7, 1.4, 1.6), label = structure(c(1L, 3L, 5L, 2L, 4L), .Label = c("1.2 (1.1, 1.3)", "1.3 (1.2, 1.4)", "1.4 (1.3, 1.5)", "1.5 (1.4, 1.6)", "1.6 (1.5, 1.7)"), class = "factor"), set = structure(c(1L, 1L, 1L, 2L, 2L), .Label = c("H", "S" ), class = "factor")), .Names = c("characteristic", "es", "ci_low", "ci_upp", "label", "set"), class = "data.frame", row.names = c(NA, -5L)) </code></pre> <p>Using <a href="https://stackoverflow.com/users/1000343/tyler-rinker">Tyler's solution</a>, a graph of it looks like that at the moment:</p> <p><img src="https://i.stack.imgur.com/5tUpb.png" alt="enter image description here"></p> <p>In a similar way to a forest plot I'd like to add a second set of labels (<code>label</code> variable in my data frame) representing graphed values, preferably on the right side of panels. So that it all mimics forest plot similar to this example:</p> <p><img src="https://i.stack.imgur.com/Febok.png" alt="enter image description here"></p> <p>I know that second axis <a href="https://stackoverflow.com/questions/3099219/how-to-use-ggplot2-make-plot-with-2-y-axes-one-y-axis-on-the-left-and-another">seems to be frowned upon</a>. However these are just another set of labels.. ant it seems to be a custom among forest plots.</p> <p>How can I do that in ggplot?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload