title: ggplot2: show legend shape based on graph's type
body: <p>I have the following tibble data:</p>
  <pre><code>d1&lt;-structure(list(Date = structure(c(18413, 18414, 18415, 18416, 
    18417, 18418, 18419, 18420, 18421, 18422), class = &quot;Date&quot;), F = c(27240.15794, 
    28169.30859, 29175.23888, 30136.86232, 31124.0537, 32096.49071, 
    33077.44196, 34053.47994, 35032.35319, 36009.5903), L95 = c(27075.72202, 
    27869.77696, 28635.16841, 29389.18107, 30126.3899, 30842.16607, 
    31542.19984, 32223.65431, 32889.86495, 33539.92631), H95 = c(27404.59386, 
    28468.84022, 29715.30936, 30884.54358, 32121.71751, 33350.81536, 
    34612.68407, 35883.30556, 37174.84142, 38479.25429), A = c(27043L, 
    27762L, 28649L, 29359L, 29921L, 30644L, 31131L, 31848L, 32510L, 
    33140L)), row.names = c(NA, -10L), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, 
   &quot;data.frame&quot;)) 
  </code></pre>
  <p>This is my code:</p>
  <pre><code> colors &lt;- c(&quot;A&quot; = &quot;black&quot;, &quot;F&quot; = &quot;blue&quot;, &quot;B&quot; = &quot;red&quot;)
   d1 %&gt;% 
    ggplot(aes(x = Date, y = A, color=&quot;A&quot;)) +
    geom_point(shape=8,fill=&quot;blue&quot;, size=1.5) + 
    geom_line() + 
    geom_point(aes(x=Date, y = F,color=&quot;F&quot;),shape=24,size=1.5) +
    geom_line() +
    geom_ribbon(aes(x = Date, y = F,ymax = L95,ymin = H95,color=&quot;B&quot;),
                fill = &quot;gray95&quot;, 
                alpha = 0.6,
                linetype=6,
                show.legend = TRUE)+
    theme_bw() +
    theme(legend.position = &quot;bottom&quot;,
          #legend.box = &quot;vertical&quot;, 
          legend.title=element_blank(),
          legend.box = NULL,
          legend.box.background = element_blank(),
          #legend.background = element_blank(),
          legend.key.size = unit(0.5, &quot;cm&quot;),
          legend.key.width = unit(0.5,&quot;cm&quot;),
          legend.direction = &quot;horizontal&quot;,
          #legend.background = element_rect(color = &quot;steelblue&quot;, linetype = &quot;solid&quot;),
          axis.text.x = element_text(color=&quot;#000000&quot;,
                                     size=10, 
                                     angle=45,
                                     hjust = 1),
          axis.text.y = element_text(color=&quot;#000000&quot;,
                                     size=10,
                                     angle=45,
                                     hjust = 1),
          axis.title.x =element_blank(),
          axis.title.y=element_text(size=14),
          panel.border = element_blank(), 
          #panel.grid.major = element_blank(),
          panel.background = element_rect(fill=&quot;#FFFFFF&quot;),
          axis.line = element_line(colour = &quot;black&quot;,
                                   size = 0.5, 
                                   linetype = &quot;solid&quot;),
          #legend.position = c(0, 160000),legend.justification = c(0, 1)
    ) + 
    
    #scale_shape_manual(values = colors)+
       scale_color_manual(values = colors)+
        scale_y_continuous(&quot;Test&quot;,expand = expansion(mult = c(0.01,0.03))) +
        scale_x_date(date_breaks = &quot;1 week&quot;, date_minor_breaks = &quot;1 week&quot;,
                 date_labels = &quot;%b/%d&quot;,
                 expand = expansion(mult = c(0.01,0.03)))
  </code></pre>
  <p>The output:</p>
  <p><a href="https://i.stack.imgur.com/h9nIm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h9nIm.png" alt="enter image description here" /></a></p>
  <p>I want to match the shape of the legend with the shape in the graph and get rid off the small boxes around each legend. Also, for some reason after I used some of the recommended legend customizations commands, the connected line of the <strong>F</strong> data changed to be points ONLY.</p>
  <p>I found some suggestions from the previous questions to <strong>melt</strong> the data ( using <em>reshape2</em> package). I did try it but I couldn't get the same ribbon graph effects especially the filled area between L95 and H95. Therefore, I eliminate this suggestion. Another suggestion was to create a list of shapes as variables same as in my code (for colors) and then use <code>scale_shape_manual</code>. I tried but I didn't get any changes in the results. I'm not sure what I'm missing. Any suggestions?</p>