<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Make legend colours consistent while using slicer (R Visuals) in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Make-legend-colours-consistent-while-using-slicer-R-Visuals/m-p/474330#M14561</link>
    <description>&lt;P&gt;Hello Sam,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your suggestion! I realise that I was not very clear in my question, sorry about that!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a Power BI template that is as generic as possible - the number of legend entries and the names of the legend entries will change each time, so I cannot hard code something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dd.col &amp;lt;- c("#FF0000FF", "#FF8B00FF", "#E8FF00FF", "#5DFF00FF")&lt;BR /&gt;names(dd.col) &amp;lt;- c("A", "B", "C', "D")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and call "scale_fill_manual("Legend", values = dd.col)"&lt;/P&gt;&lt;P&gt;in ggplot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to create a new colour palette,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Create color vector&lt;BR /&gt;dd.col &amp;lt;- rainbow(length(unique(dataset$LegendEntries)))&lt;BR /&gt;names(dd.col)&amp;nbsp; &amp;lt;- unique(dataset$LegendEntries)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like this, but the colours reset when I choose a subset of information using the Slicer in Power BI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you know of a way to work around this? Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Fel&lt;/P&gt;</description>
    <pubDate>Sat, 28 Jul 2018 10:08:00 GMT</pubDate>
    <dc:creator>fgmh</dc:creator>
    <dc:date>2018-07-28T10:08:00Z</dc:date>
    <item>
      <title>Make legend colours consistent while using slicer (R Visuals)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Make-legend-colours-consistent-while-using-slicer-R-Visuals/m-p/472808#M14518</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created my own R visuals using ggplot2, which automatically chooses a colour scheme for my legend. However, when I use the slicer to filter the data, the colours are reassigned, making it visually a bit disorienting to the user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, before using the slicer:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;A - Red&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#99CC00"&gt;B - Green&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#00CCFF"&gt;C - Blue&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF9900"&gt;D - Orange&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After using the slicer to select C and &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;C - Red&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#99CC00"&gt;B - Green&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to make it such that after selecting C and D in the slicer, this is what I get:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#00CCFF"&gt;C - Blue&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF9900"&gt;D -&amp;nbsp;Orange&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 13:54:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Make-legend-colours-consistent-while-using-slicer-R-Visuals/m-p/472808#M14518</guid>
      <dc:creator>fgmh</dc:creator>
      <dc:date>2018-07-26T13:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Make legend colours consistent while using slicer (R Visuals)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Make-legend-colours-consistent-while-using-slicer-R-Visuals/m-p/474308#M14560</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/66715"&gt;@fgmh&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on my test, you may use&amp;nbsp;&lt;A href="https://www.rdocumentation.org/packages/ggplot2/versions/2.2.1/topics/scale_manual" target="_blank"&gt;scale_manual&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jul 2018 08:48:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Make-legend-colours-consistent-while-using-slicer-R-Visuals/m-p/474308#M14560</guid>
      <dc:creator>v-chuncz-msft</dc:creator>
      <dc:date>2018-07-28T08:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Make legend colours consistent while using slicer (R Visuals)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Make-legend-colours-consistent-while-using-slicer-R-Visuals/m-p/474330#M14561</link>
      <description>&lt;P&gt;Hello Sam,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your suggestion! I realise that I was not very clear in my question, sorry about that!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a Power BI template that is as generic as possible - the number of legend entries and the names of the legend entries will change each time, so I cannot hard code something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dd.col &amp;lt;- c("#FF0000FF", "#FF8B00FF", "#E8FF00FF", "#5DFF00FF")&lt;BR /&gt;names(dd.col) &amp;lt;- c("A", "B", "C', "D")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and call "scale_fill_manual("Legend", values = dd.col)"&lt;/P&gt;&lt;P&gt;in ggplot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to create a new colour palette,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Create color vector&lt;BR /&gt;dd.col &amp;lt;- rainbow(length(unique(dataset$LegendEntries)))&lt;BR /&gt;names(dd.col)&amp;nbsp; &amp;lt;- unique(dataset$LegendEntries)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like this, but the colours reset when I choose a subset of information using the Slicer in Power BI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you know of a way to work around this? Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Fel&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jul 2018 10:08:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Make-legend-colours-consistent-while-using-slicer-R-Visuals/m-p/474330#M14561</guid>
      <dc:creator>fgmh</dc:creator>
      <dc:date>2018-07-28T10:08:00Z</dc:date>
    </item>
  </channel>
</rss>

