Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Jdbaba,</p> <p>From your comments, you mentioned that you'd like for the <code>geom_point</code> to have just the <code>.</code> in the legend. This is a feature that is yet to be implemented to be used directly in <code>ggplot2</code> (if I am right). However, there's a fix/work-around that is given by <code>@Aniko</code> in <a href="https://stackoverflow.com/questions/2253179/using-ggplot2-how-can-i-represent-a-dot-and-a-line-in-the-legend"><strong>this post</strong></a>. Its a bit tricky but brilliant! And it works great. Here's a version that I tried out. Hope it is what you expected.</p> <pre><code># bind both your data.frames df &lt;- rbind(tempcal, tempobs) p &lt;- ggplot(data = df, aes(x = time, y = data, colour = group1, linetype = group1, shape = group1)) p &lt;- p + geom_line() + geom_point() p &lt;- p + scale_shape_manual("", values=c(NA, NA, 19)) p &lt;- p + scale_linetype_manual("", values=c(1,1,0)) p &lt;- p + scale_colour_manual("", values=c("#F0E442", "#0072B2", "#D55E00")) p &lt;- p + facet_wrap(~ id, ncol = 1) p </code></pre> <p>The idea is to first create a plot with all <em>necessary</em> attributes set in the aesthetics section, plot what you want and then change settings manually later using <code>scale_._manual</code>. You can <code>unset</code> lines by a <code>0</code> in <code>scale_linetype_manual</code> for example. Similarly you can <code>unset</code> points for lines using <code>NA</code> in <code>scale_shape_manual</code>. Here, the first two values are for <code>group1=maximum and minimum</code> and the last is for <code>observed</code>. So, we set <code>NA</code> to the first two for <code>maximum</code> and <code>minimum</code> and set <code>0</code> to <code>linetype</code> for <code>observed</code>.</p> <p>And this is the plot:</p> <p><img src="https://i.stack.imgur.com/16nRm.png" alt="enter image description here"></p>
 

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