title: R sankeyNetwork d3.scaleOrdinal() - why the colors of the last two nodes do not change
body: <p>I am working on manually changing the color of the bars in a sankey diagram, but for the last three categories, the colors do not vary according to the new color_scale and &quot;yellow&quot; is assigned to all of the three last categories.</p>
  <p>'''</p>
  <pre><code>color_scale &lt;- 'd3.scaleOrdinal().
                    range([&quot;gainsboro&quot;,&quot;dimgray&quot;, &quot;black&quot; , 
  &quot;darkred&quot;,&quot;red&quot;,&quot;tomato&quot;, &quot;lightsalmon&quot;, 
  &quot;royalblue&quot;,&quot;blue&quot;,  &quot;midnightblue&quot;, &quot;deepskyblue&quot;, 
  &quot;yellow&quot;, &quot;green&quot;,&quot;red&quot;])'
  sankeyNetwork(Links = resparking$links, Nodes = resparking$nodes, Source = &quot;source&quot;,
                Target = &quot;target&quot;, Value = &quot;value&quot;, NodeID = &quot;name&quot;,
                units = &quot;Number of Houses&quot;, 
                fontSize = 20, nodeWidth = 30, 
                colourScale = JS(color_scale))
  </code></pre>
  <p>'''</p>
  <p>The data can be downloaded here: <a href="https://drive.google.com/file/d/1hPq-PvW89hsVylrLA0anqDFB-OrjBJIz/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1hPq-PvW89hsVylrLA0anqDFB-OrjBJIz/view?usp=sharing</a></p>
  <p>The graph and data look like this:
  [enter image description here][1]
  [1]: https://i.stack.imgur.com/2EqAF.png</p>