title: In R can I sort by multiple factors in a plot's legend?
body: <p>My goal is to associate points with multiple legends attributes to help someone actively filter the graph for comparison. For example, I tried to associate each point in my code with its DP  and its description independently. that way I could hide all points except DP1 points OR only show Test one results. instead, my code makes each point unique as a combination of its factors.
  Thank you for your help!</p>
  <p>Here is my attempt.</p>
  <pre><code>library(tidyverse)
  library(plotly)
  
  df = read.csv(&quot;C:/Users/nicho/Documents/R/Test.csv&quot;)
  
  output = df %&gt;%
  ggplot(df,mapping = aes(Wave,Score,col = factor(Level),
                          text = paste(&quot;DP:&quot;,DP,&quot;&lt;br&gt;&quot;,
                                       &quot;Wave:&quot;,Wave,&quot;&lt;br&gt;&quot;,
                                       &quot;Level:&quot;,Level,&quot;&lt;br&gt;&quot;,
                                       &quot;Score:&quot;,Score,&quot;&lt;br&gt;&quot;,
                                       &quot;Desc:&quot;,Desc
                                       
                          )
                          
                          ))+
    geom_line(mapping = aes(group = DP))+
    geom_point(mapping = aes(col =factor(DP),shape = factor(Desc)))+
    facet_grid(~Location)
  
  font = list(
    size = 15,
    color = &quot;white&quot;
  )
  
  label = list(
    bgcolor = &quot;#232F34&quot;,
    bordercolor = &quot;transparent&quot;,
    font = font
    
  )
  
  
  ggplotly(output, tooltip = c(&quot;text&quot;)) %&gt;%
    style(hoverlabel = label) %&gt;%
    layout(font = font)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/wk9sO.png" rel="nofollow noreferrer">Output</a></p>