<?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: Scatterplot with negative data (SGPLOT) in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276401#M9865</link>
    <description>&lt;P&gt;I think I've settled on the below as my solution. Moving the axis labels up to the x-axis would be too cluttered. Thanks for the 'band' suggestion. (I didn't test the 'block' suggestion) (The lineparam statement is how I plot the contour lines).&lt;/P&gt;&lt;PRE&gt;proc sgplot noautolegend aspect=1;
  band x=M upper=0 lower=-0.1 / transparency=0.8 fillattrs=(color=grey);
  scatter x=M y=T /datalabel=ID markerattrs=(size=10) ;
  lineparm x=x y=y slope=slope ;
  xaxis grid max=0.6 offsetmin=0 ;
  yaxis grid min=-0.1 max=0.5 offsetmin=0 values=(-0.1 to 0.5 by 0.1) 
        Label = "T (also D = M+T diagonally)" labelpos=top;
  refline 0 /axis=x ;
  refline 0 /axis=y ;
run;&lt;/PRE&gt;&lt;P&gt;This produces&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3561i382ABFCEDF8E0D09/image-size/medium?v=v2&amp;amp;px=-1" alt="Capture.PNG" title="Capture.PNG" border="0" /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jun 2016 02:32:09 GMT</pubDate>
    <dc:creator>BruceBrad</dc:creator>
    <dc:date>2016-06-10T02:32:09Z</dc:date>
    <item>
      <title>Scatterplot with negative data (SGPLOT)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276172#M9857</link>
      <description>&lt;P&gt;I have a scatterplot with mostly positive data, but some negative Y values. I want to distinguish between the positive and negative values. I'm currently drawing the axes with a refline statement at 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One option would be to have the x-axis labels next to this refline - emphasising that this where the x-axis lies. Can this be done?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another would be to shade the positive area different from the negative area (sounds more difficult).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 08:01:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276172#M9857</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2016-06-09T08:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Scatterplot with negative data (SGPLOT)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276175#M9858</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you mock up a quick picture to explain what it looks like. &amp;nbsp;Normally you would have xaxis and yaxis defined by those statements in you sgplot call, they then have options to control where labels go and such like. &amp;nbsp;There would then be the four quadrants which highlight where the data fall. &amp;nbsp;Have you removed the axis lines and are trying to draw them yourself?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 08:13:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276175#M9858</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-09T08:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Scatterplot with negative data (SGPLOT)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276211#M9859</link>
      <description>&lt;P&gt;You can use the BLOCK statement in PROC SGPLOT to make the background of the positive and negative regions different shades of gray (or color).&amp;nbsp; I have an example&amp;nbsp;in the article &lt;A href="http://blogs.sas.com/content/iml/2015/12/09/categories-histogram-block-plot.html" target="_self"&gt;"Overlay categories on a histogram,"&lt;/A&gt;&amp;nbsp;which you ought to be able to modify for your case.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 10:21:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276211#M9859</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-06-09T10:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Scatterplot with negative data (SGPLOT)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276276#M9860</link>
      <description>&lt;P&gt;This can also be done with band plots when you know the range of your data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
do t=1 to 50;
   x=ranuni(123);
   if (t &amp;lt;= 25) then
      y = -ranuni(456);
   else
      y = ranuni(456);
   output;
end;
run;

proc sgplot data=example;
band x=x upper=1 lower=0 / fillattrs=(color=yellow);
band x=x upper=0 lower=-1 / fillattrs=(color=lavender);
refline 0 / lineattrs=(thickness=3);
scatter x=x y=y;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Jun 2016 14:35:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276276#M9860</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2016-06-09T14:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Scatterplot with negative data (SGPLOT)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276385#M9864</link>
      <description>&lt;P&gt;Thanks for the suggestions. The band option handles the shading issue well. But here is my output so far. I'm actually trying to represent the values of three variables: M on the x-axis, T on the y-axis and D=M+T - represented by the diagonal contours. (The points are different countries).&amp;nbsp; Having the x-axis labels at the bottom is confusing if you are trying to read of the values of D (you need to read them off where the line crosses the x-axis).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3560iE5453825BDEB2C1C/image-size/medium?v=v2&amp;amp;px=-1" alt="Capture.PNG" title="Capture.PNG" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 02:06:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276385#M9864</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2016-06-10T02:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Scatterplot with negative data (SGPLOT)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276401#M9865</link>
      <description>&lt;P&gt;I think I've settled on the below as my solution. Moving the axis labels up to the x-axis would be too cluttered. Thanks for the 'band' suggestion. (I didn't test the 'block' suggestion) (The lineparam statement is how I plot the contour lines).&lt;/P&gt;&lt;PRE&gt;proc sgplot noautolegend aspect=1;
  band x=M upper=0 lower=-0.1 / transparency=0.8 fillattrs=(color=grey);
  scatter x=M y=T /datalabel=ID markerattrs=(size=10) ;
  lineparm x=x y=y slope=slope ;
  xaxis grid max=0.6 offsetmin=0 ;
  yaxis grid min=-0.1 max=0.5 offsetmin=0 values=(-0.1 to 0.5 by 0.1) 
        Label = "T (also D = M+T diagonally)" labelpos=top;
  refline 0 /axis=x ;
  refline 0 /axis=y ;
run;&lt;/PRE&gt;&lt;P&gt;This produces&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3561i382ABFCEDF8E0D09/image-size/medium?v=v2&amp;amp;px=-1" alt="Capture.PNG" title="Capture.PNG" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 02:32:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatterplot-with-negative-data-SGPLOT/m-p/276401#M9865</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2016-06-10T02:32:09Z</dc:date>
    </item>
  </channel>
</rss>

