<?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: plot multiple variables on the same axis in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432762#M14940</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Dan, any idea to fix the plot below? I also put the plot desired below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=plot /*data attached*/;  
series x=risk_out y=mean_bias / group=agecat;
series x=risk_in y=mean_bias / group=agecat x2axis;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Output from above code:&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="Dan.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18231i6F41BCF8386F672E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Dan.png" alt="Dan.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV class="c"&gt;Plot I need:&lt;/DIV&gt;&lt;DIV class="c"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="plot desired.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18235iD2BE758653764E79/image-size/large?v=v2&amp;amp;px=999" role="button" title="plot desired.png" alt="plot desired.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV class="c"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 31 Jan 2018 14:43:23 GMT</pubDate>
    <dc:creator>Cruise</dc:creator>
    <dc:date>2018-01-31T14:43:23Z</dc:date>
    <item>
      <title>plot multiple variables on the same axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432516#M14915</link>
      <description>&lt;P&gt;How to create plot=desired in the image below at&amp;nbsp;bottom&amp;nbsp;instead two separate plots have1 and have2? Data attached in text file. Using SAS 9.4.&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="PLOT MULTIPLE AXIS.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18222iF11FF2F793FAA64E/image-size/large?v=v2&amp;amp;px=999" role="button" title="PLOT MULTIPLE AXIS.png" alt="PLOT MULTIPLE AXIS.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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile="...\plot.txt"
out=c.testplot
dbms=tab replace;
guessingrows=max;
run;

proc sgplot data=plot;
series x=risk_out y=mean_bias / group=agecat;
run;
proc sgplot data=plot;
series x=risk_out y=mean_bias / group=agecat;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jan 2018 21:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432516#M14915</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2018-01-30T21:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: plot multiple variables on the same axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432528#M14917</link>
      <description>&lt;P&gt;Try this and see if you like it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=plot;
series x=risk_out y=mean_bias / group=agecat;
series x=risk_out y=mean_bias / group=agecat x2axis;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 21:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432528#M14917</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2018-01-30T21:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: plot multiple variables on the same axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432532#M14918</link>
      <description>Thanks a lot. Worked out. Now I'll focus on aesthetics of the plot.</description>
      <pubDate>Tue, 30 Jan 2018 21:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432532#M14918</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2018-01-30T21:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: plot multiple variables on the same axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432564#M14919</link>
      <description>&lt;P&gt;You'll need an attribute map then you can set the colors the same across the two groups, perhaps one set is dashed and the other isn't to differentiate easily...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/01/30/auto-discrete-attr-map.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2017/01/30/auto-discrete-attr-map.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 23:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432564#M14919</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-30T23:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: plot multiple variables on the same axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432727#M14938</link>
      <description>Hi Reeza, I'm curious. You said two groups (risk_in and risk_out)? I have two groups aligned with same values. So I don't need differentiation between groups. However, my lines differ by strata variable agecat. Please let me know I'm missing something</description>
      <pubDate>Wed, 31 Jan 2018 13:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432727#M14938</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2018-01-31T13:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: plot multiple variables on the same axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432762#M14940</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Dan, any idea to fix the plot below? I also put the plot desired below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=plot /*data attached*/;  
series x=risk_out y=mean_bias / group=agecat;
series x=risk_in y=mean_bias / group=agecat x2axis;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Output from above code:&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="Dan.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18231i6F41BCF8386F672E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Dan.png" alt="Dan.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV class="c"&gt;Plot I need:&lt;/DIV&gt;&lt;DIV class="c"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="plot desired.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18235iD2BE758653764E79/image-size/large?v=v2&amp;amp;px=999" role="button" title="plot desired.png" alt="plot desired.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV class="c"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 31 Jan 2018 14:43:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432762#M14940</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2018-01-31T14:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: plot multiple variables on the same axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432784#M14941</link>
      <description>&lt;P&gt;Without seeing the data, or knowing the full intent of the plot, I'm going to have to make a guess at your desired outcome. It appears that you really want to draw only RISK_OUT, but you want a secondary axis influenced by RISK_IN. If that is true, then you just need to make your RISK_IN plot fully transparent, like the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=plot /*data attached*/;  
series x=risk_out y=mean_bias / group=agecat;
series x=risk_in y=mean_bias / group=agecat x2axis transparency=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Let me know if this works for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;BR /&gt;Dan&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 15:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432784#M14941</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2018-01-31T15:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: plot multiple variables on the same axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432804#M14946</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Thanks Dan.&lt;/P&gt;&lt;P&gt;Response variable 'mean_bias' aligns with unique reverse combination of risk_in and risk_out. So showing 'mean_bias' as a function of reverse combinations of risk_in and risk_out is the goal of the plot.&lt;/P&gt;&lt;P&gt;Plot desired shows that Risk_in takes 0 when Risk_out takes 1.0. These two risks are complementary to each other where max probability can not exceed 1. So, risk_in can not take 1 when risk_out takes 1. In other words, if one adds risk_in+risk_out at each increment the total always would be 1. I put in the first few observations of data where group variable was cut. But hopefully, this chunk of data would tell you the story of how my data is organized at least for the relationship between 'mean_bias' and the reverse combination of 'risk_in' and 'risk_out'. I have 62 counties. So after axis issue's solved I will have to think of panel options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dan;
input agecat county	risk_in	risk_out mean_bias;
datalines;
1	83	0	0.05	0.1592907908
1	83	0	0.1	0.233784996
1	83	0.05	0.1	0.233784996
1	83	0.1	0.15	0.3085880658
1	83	0.05	0.15	0.3085880658
1	83	0	0.15	0.3085880658
1	83	0	0.2	0.3837018973
1	83	0.15	0.2	0.3837018973
1	83	0.05	0.2	0.3837018973
1	3	0.1	0.2	0.3837018973
1	3	0	0.25	0.4591284108
1	3	0.15	0.25	0.4591284108
1	3	0.2	0.25	0.4591284108
1	3	0.1	0.25	0.4591284108
1	3	0.05	0.25	0.4591284108
1	3	0.1	0.3	0.5348695495
1	3	0.2	0.3	0.5348695495
1	3	0.15	0.3	0.5348695495
1	3	0.25	0.3	0.5348695495
;

proc sgplot data=dan /*data attached*/;  
series x=risk_out y=mean_bias / group=agecat;
series x=risk_in y=mean_bias / group=agecat x2axis transparency=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Desired plot:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="plot desired.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18238i6A1AB78EA1E70F0A/image-size/large?v=v2&amp;amp;px=999" role="button" title="plot desired.png" alt="plot desired.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 15:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/plot-multiple-variables-on-the-same-axis/m-p/432804#M14946</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2018-01-31T15:58:17Z</dc:date>
    </item>
  </channel>
</rss>

