<?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 Assigning colors in violinplot in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606039#M17323</link>
    <description>&lt;P&gt;Hi.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to assign different colors to my violinplot, but cant figure out how to. The styleatrrs is not working for me. Below my code. I want to make different colors for the plot based on value in RG (horisontal panel).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally also a lighter shade in præpost_kat (vertical panel) depending on value. But that is not as important&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgpanel data=plot;&lt;BR /&gt;where rg in (0,1);&lt;BR /&gt;panelby rg præpost_kat / layout=lattice onepanel novarname noborder colheaderpos=bottom;&lt;BR /&gt;band y=tils upper=density lower=mirror / fill outline;&lt;BR /&gt;format rg rgx. præpost_kat bean_katx.;&lt;BR /&gt;colaxis display=none;&lt;BR /&gt;rowaxis label='TILs' grid;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its getting me this. Which I want. But I cant change the colors, and google cant help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you in advance&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bean.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34121i88430707878A0243/image-size/large?v=v2&amp;amp;px=999" role="button" title="bean.jpg" alt="bean.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Nov 2019 08:21:55 GMT</pubDate>
    <dc:creator>Signesk</dc:creator>
    <dc:date>2019-11-21T08:21:55Z</dc:date>
    <item>
      <title>Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606039#M17323</link>
      <description>&lt;P&gt;Hi.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to assign different colors to my violinplot, but cant figure out how to. The styleatrrs is not working for me. Below my code. I want to make different colors for the plot based on value in RG (horisontal panel).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally also a lighter shade in præpost_kat (vertical panel) depending on value. But that is not as important&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgpanel data=plot;&lt;BR /&gt;where rg in (0,1);&lt;BR /&gt;panelby rg præpost_kat / layout=lattice onepanel novarname noborder colheaderpos=bottom;&lt;BR /&gt;band y=tils upper=density lower=mirror / fill outline;&lt;BR /&gt;format rg rgx. præpost_kat bean_katx.;&lt;BR /&gt;colaxis display=none;&lt;BR /&gt;rowaxis label='TILs' grid;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its getting me this. Which I want. But I cant change the colors, and google cant help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you in advance&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bean.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34121i88430707878A0243/image-size/large?v=v2&amp;amp;px=999" role="button" title="bean.jpg" alt="bean.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 08:21:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606039#M17323</guid>
      <dc:creator>Signesk</dc:creator>
      <dc:date>2019-11-21T08:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606040#M17324</link>
      <description>&lt;P&gt;Are you able to post your data or a sample of it for testing?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 08:21:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606040#M17324</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-21T08:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606041#M17325</link>
      <description>I will have to check sine it is patient data. And do I just type it in below in colums or attach as a sasdatafile?</description>
      <pubDate>Thu, 21 Nov 2019 08:23:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606041#M17325</guid>
      <dc:creator>Signesk</dc:creator>
      <dc:date>2019-11-21T08:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606043#M17326</link>
      <description>&lt;P&gt;Up to you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 08:31:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606043#M17326</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-21T08:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606044#M17327</link>
      <description>&lt;P&gt;So I have some of the data here. It is data=sorted&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I saved it in excel and changed the name so I didnt use æ with is specifik to Denmark &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then I hade this code, before the code I posted at the first post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc kde data=sorted;&lt;BR /&gt;by rg 'præpost_kat'n;&lt;BR /&gt;univar tils / plots=none out=tils_dens (rename=(value=tils));&lt;BR /&gt;run;&lt;BR /&gt;data plot;&lt;BR /&gt;set tils_dens;&lt;BR /&gt;mirror=-density;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 08:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606044#M17327</guid>
      <dc:creator>Signesk</dc:creator>
      <dc:date>2019-11-21T08:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606049#M17328</link>
      <description>&lt;P&gt;Good thing you caught a fellow dane then &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I made a few changes to your code and inserted an attribute map to control the colors.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Feel free to ask if you have any questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sorted;
input TILs prepost_kat rg;
datalines;
1    1    0
5    1    0
20   1    0
5    1    0
10   1    0
5    1    0
0    1    0
10    1    0
0    1    0
50    1    0
10    1    0
20    1    0
10    1    0
10    1    0
5    1    0
5    1    0
10    1    0
5    1    0
10    1    0
0    1    0
0    1    0
0    1    0
0    1    0
30    1    0
1    1    0
20    1    0
5    1    0
10    1    0
5    1    0
1    1    0
0    1    0
5    1    0
0    1    0
30    1    0
20    1    0
10    1    0
5    1    0
5    1    0
1    1    0
0    1    0
5    1    0
20    1    0
5    1    0
20    1    0
1    2    0
5    2    0
5    2    0
20    2    0
50    2    0
0    2    0
1    2    0
30    2    0
20    2    0
80    2    0
70    2    0
40    2    0
5    2    0
30    2    0
20    2    0
30    2    0
5    2    0
50    2    0
10    2    0
10    2    0
1    2    0
0    2    0
20    2    0
30    2    0
10    2    0
30    2    0
40    2    0
20    2    0
5    2    0
10    2    0
0    2    0
1    2    0
5    2    0
5    2    0
20    2    0
30    2    0
30    2    0
30    2    0
20    2    0
0    2    0
1    2    0
20    2    0
5    2    0
40    2    0
40    1    1
0    1    1
5    1    1
20    1    1
30    1    1
10    1    1
1    1    1
5    1    1
5    1    1
50    1    1
1    1    1
1    1    1
5    1    1
10    1    1
1    1    1
20    1    1
5    1    1
10    1    1
5    1    1
40    1    1
1    1    1
10    1    1
20    1    1
5    1    1
10    1    1
0    1    1
1    1    1
30    1    1
30    1    1
20    1    1
10    1    1
5    1    1
0    1    1
10    1    1
5    1    1
5    1    1
20    1    1
10    1    1
5    1    1
30    1    1
5    1    1
5    1    1
5    1    1
5    1    1
1    1    1
0    1    1
1    1    1
20    1    1
5    1    1
0    1    1
0    1    1
30    1    1
0    1    1
0    1    1
1    1    1
10    1    1
20    1    1
30    1    1
1    2    1
5    2    1
20    2    1
1    2    1
5    2    1
10    2    1
5    2    1
5    2    1
30    2    1
50    2    1
30    2    1
5    2    1
5    2    1
30    2    1
5    2    1
20    2    1
5    2    1
5    2    1
10    2    1
20    2    1
30    2    1
5    2    1
50    2    1
40    2    1
10    2    1
30    2    1
5    2    1
5    2    1
20    2    1
30    2    1
30    2    1
10    2    1
20    2    1
20    2    1
20    2    1
10    2    1
10    2    1
30    2    1
10    2    1
5    2    1
10    2    1
0    2    1
5    2    1
1    2    1
10    2    1
0    2    1
10    2    1
20    2    1
5    2    1
10    2    1
5    2    1
20    2    1
1    2    1
1    2    1
5    2    1
15    2    1
10    2    1
30    2    1
;

proc kde data=sorted;
by rg prepost_kat;
univar tils / plots=none out=tils_dens (rename=(value=tils));
run;

data plot;
set tils_dens;
by prepost_kat notsorted;
mirror=-density;
if first.prepost_kat then group+1;
run;

data myattrmap;
input ID $ value linecolor $ fillcolor $;
datalines;
myid 1 blue  blue
myid 2 green green
myid 3 red   red
myid 4 gold  gold
;

proc sgpanel data=plot dattrmap=myattrmap noautolegend;
where rg in (0,1);
panelby rg prepost_kat / layout=lattice onepanel novarname noborder colheaderpos=bottom;
band y=tils upper=density lower=mirror / group=group fill outline;
format rg rgx. prepost_kat bean_katx.;
colaxis display=none;
rowaxis label='TILs' grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Udklip.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34122i5AEF396DAF01CE91/image-size/large?v=v2&amp;amp;px=999" role="button" title="Udklip.PNG" alt="Udklip.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 08:44:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606049#M17328</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-21T08:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606050#M17329</link>
      <description>Thank you so much. This is exactly it!</description>
      <pubDate>Thu, 21 Nov 2019 08:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606050#M17329</guid>
      <dc:creator>Signesk</dc:creator>
      <dc:date>2019-11-21T08:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606051#M17330</link>
      <description>&lt;P&gt;Anytime &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 08:47:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606051#M17330</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-21T08:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606056#M17331</link>
      <description>follow up question.&lt;BR /&gt;I want to make the blue and red the same color and the green and gold as well&lt;BR /&gt;&lt;BR /&gt;I tried changing your code like this&lt;BR /&gt;&lt;BR /&gt;data myattrmap;&lt;BR /&gt;input ID $ value linecolor $ fillcolor $;&lt;BR /&gt;datalines;&lt;BR /&gt;myid 1 blue blue&lt;BR /&gt;myid 2 green green&lt;BR /&gt;myid 3 blue blue&lt;BR /&gt;myid 4 green green&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;But it remains in the four original colors.</description>
      <pubDate>Thu, 21 Nov 2019 08:58:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606056#M17331</guid>
      <dc:creator>Signesk</dc:creator>
      <dc:date>2019-11-21T08:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606243#M17361</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/300591"&gt;@Signesk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;follow up question.&lt;BR /&gt;I want to make the blue and red the same color and the green and gold as well&lt;BR /&gt;&lt;BR /&gt;I tried changing your code like this&lt;BR /&gt;&lt;BR /&gt;data myattrmap;&lt;BR /&gt;input ID $ value linecolor $ fillcolor $;&lt;BR /&gt;datalines;&lt;BR /&gt;myid 1 blue blue&lt;BR /&gt;myid 2 green green&lt;BR /&gt;myid 3 blue blue&lt;BR /&gt;myid 4 green green&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;But it remains in the four original colors.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Add the option :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;attrid&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;=myid&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;to the BAND statement options.&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;band y=tils upper=density lower=mirror / group=group fill outline attrid=myid;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Nov 2019 18:13:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606243#M17361</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-21T18:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606940#M17465</link>
      <description>Thank you! Problem solved</description>
      <pubDate>Mon, 25 Nov 2019 12:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/606940#M17465</guid>
      <dc:creator>Signesk</dc:creator>
      <dc:date>2019-11-25T12:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning colors in violinplot</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/609314#M17866</link>
      <description>&lt;P&gt;Follow up question number two!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I publish it as pdf/png or just copy it into powerpoint and enlarge it a new problem arises. The figure in the right top corner remains fine, but the three others seems to have a dotted line around them, I haven't changed anything in the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data myattrmap;&lt;BR /&gt;input ID $ value linecolor $ fillcolor $;&lt;BR /&gt;datalines;&lt;BR /&gt;myid 1 CXCD5C5C CXCD5C5C&lt;BR /&gt;myid 2 cx880000 cx880000&lt;BR /&gt;myid 3 CXCD5C5C CXCD5C5C&lt;BR /&gt;myid 4 cx880000 cx880000&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sgpanel data=plot dattrmap=myattrmap noautolegend;&lt;BR /&gt;where rg in (0,1);&lt;BR /&gt;panelby rg prepost_kat / layout=lattice onepanel novarname noborder colheaderpos=bottom;&lt;BR /&gt;band y=tils upper=density lower=mirror / group=group fill outline attrid=myid;&lt;BR /&gt;format rg rgx. prepost_kat katx.;&lt;BR /&gt;colaxis display=none;&lt;BR /&gt;rowaxis label='TILs %' grid;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="beanplot tils.png" style="width: 457px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34433iBBF058F510270286/image-dimensions/457x457?v=v2" width="457" height="457" role="button" title="beanplot tils.png" alt="beanplot tils.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried changing the linecolor to black and it very well illustrates the problem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data myattrmap;&lt;BR /&gt;input ID $ value linecolor $ fillcolor $;&lt;BR /&gt;datalines;&lt;BR /&gt;myid 1 black CXCD5C5C&lt;BR /&gt;myid 2 black cx880000&lt;BR /&gt;myid 3 CXCD5C5C CXCD5C5C&lt;BR /&gt;myid 4 cx880000 cx880000&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tilsbal.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34436iC82F13198DC4BE7A/image-size/large?v=v2&amp;amp;px=999" role="button" title="tilsbal.png" alt="tilsbal.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I want the linecolor to be solid. Thank you in advance&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 09:22:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assigning-colors-in-violinplot/m-p/609314#M17866</guid>
      <dc:creator>Signesk</dc:creator>
      <dc:date>2019-12-04T09:22:33Z</dc:date>
    </item>
  </channel>
</rss>

