<?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: Scatter plot matrix axes in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/687658#M20530</link>
    <description>&lt;P&gt;No, not explicitly, because the axes depend on the data. But if your data are always between [0,1] you can do the following:&lt;/P&gt;
&lt;P&gt;1. Add "fake" data that won't be plotted but will force the axes to use [0,1] on each axis.&lt;/P&gt;
&lt;P&gt;2. Make sure the scatter plot matrix is large enough that the horiz ticks do not get auto-thinned:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* 1. Force [0,1] for each axis */
data Fake;
 var_a = 0; var_b = .; var_c = .; var_d = .; var_e = .; output;
 var_a = 1; var_b = .; var_c = .; var_d = .; var_e = .; output;
 var_a = .; var_b = 0; var_c = .; var_d = .; var_e = .; output;
 var_a = .; var_b = 1; var_c = .; var_d = .; var_e = .; output;
 var_a = .; var_b = .; var_c = 0; var_d = .; var_e = .; output;
 var_a = .; var_b = .; var_c = 1; var_d = .; var_e = .; output;
 var_a = .; var_b = .; var_c = .; var_d = 0; var_e = .; output;
 var_a = .; var_b = .; var_c = .; var_d = 1; var_e = .; output;
 var_a = .; var_b = .; var_c = .; var_d = .; var_e = 0; output;
 var_a = .; var_b = .; var_c = .; var_d = .; var_e = 0; output;
run;

data Want;
set Fake Have;
run;

/* 2. Prevent auto-thinning of tick marks */
ods graphics / width=1000px height=800px;
proc sgscatter data = Want;
 compare y = ( var_a var_b var_c var_d var_e )
         x = ( var_a var_b var_c var_d var_e ) /
 reg spacing = 4 grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Sep 2020 21:00:12 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2020-09-29T21:00:12Z</dc:date>
    <item>
      <title>Scatter plot matrix axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/687654#M20529</link>
      <description>&lt;P&gt;I have 5 variables with the same units that I'd like to create a scatterplot matrix for with regression lines. I used PROC SGSCATTER below. Is there a way to set the x- and y- axis ranges from 0 to 1 by 0.25?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ( keep = id var_: );
 set sashelp.bweight;
 if _N_ &amp;lt;= 20;
 id = _N_;
 var_a = ranuni ( 1 );
 var_b = ranuni ( 2 );
 var_c = ranuni ( 3 );
 var_d = ranuni ( 4 );
 var_e = ranuni ( 5 );
 label var_a = "Variable A"
       var_b = "Variable B"
       var_c = "Variable C"
	   var_d = "Variable D"
       var_e = "Variable E";
run;

proc sgscatter data = have;
 compare y = ( var_a var_b var_c var_d var_e )
         x = ( var_a var_b var_c var_d var_e ) /
 reg spacing = 4;
run; quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:04:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/687654#M20529</guid>
      <dc:creator>bkq32</dc:creator>
      <dc:date>2020-09-29T20:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Scatter plot matrix axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/687658#M20530</link>
      <description>&lt;P&gt;No, not explicitly, because the axes depend on the data. But if your data are always between [0,1] you can do the following:&lt;/P&gt;
&lt;P&gt;1. Add "fake" data that won't be plotted but will force the axes to use [0,1] on each axis.&lt;/P&gt;
&lt;P&gt;2. Make sure the scatter plot matrix is large enough that the horiz ticks do not get auto-thinned:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* 1. Force [0,1] for each axis */
data Fake;
 var_a = 0; var_b = .; var_c = .; var_d = .; var_e = .; output;
 var_a = 1; var_b = .; var_c = .; var_d = .; var_e = .; output;
 var_a = .; var_b = 0; var_c = .; var_d = .; var_e = .; output;
 var_a = .; var_b = 1; var_c = .; var_d = .; var_e = .; output;
 var_a = .; var_b = .; var_c = 0; var_d = .; var_e = .; output;
 var_a = .; var_b = .; var_c = 1; var_d = .; var_e = .; output;
 var_a = .; var_b = .; var_c = .; var_d = 0; var_e = .; output;
 var_a = .; var_b = .; var_c = .; var_d = 1; var_e = .; output;
 var_a = .; var_b = .; var_c = .; var_d = .; var_e = 0; output;
 var_a = .; var_b = .; var_c = .; var_d = .; var_e = 0; output;
run;

data Want;
set Fake Have;
run;

/* 2. Prevent auto-thinning of tick marks */
ods graphics / width=1000px height=800px;
proc sgscatter data = Want;
 compare y = ( var_a var_b var_c var_d var_e )
         x = ( var_a var_b var_c var_d var_e ) /
 reg spacing = 4 grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:00:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/687658#M20530</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-09-29T21:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Scatter plot matrix axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/687663#M20537</link>
      <description>Cool trick, thank you!</description>
      <pubDate>Tue, 29 Sep 2020 21:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/687663#M20537</guid>
      <dc:creator>bkq32</dc:creator>
      <dc:date>2020-09-29T21:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Scatter plot matrix axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/687756#M20540</link>
      <description>&lt;P&gt;The trick has many uses. For a discussion and other applications, see &lt;A href="https://blogs.sas.com/content/iml/2016/02/17/include-and-order-categories-in-legends.html" target="_self"&gt;"A simple trick to include (and order!) all categories in SGPLOT legends."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 09:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/687756#M20540</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-09-30T09:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Scatter plot matrix axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/785080#M22402</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp; can you please help.&lt;/P&gt;
&lt;DIV class="lia-component-topic-message"&gt;
&lt;DIV class="linear-message-list message-list"&gt;
&lt;DIV id="lineardisplaymessageviewwrapper" class="lia-linear-display-message-view"&gt;
&lt;DIV class="first-message"&gt;
&lt;DIV id="messageview" class="lia-panel-message message-uid-785049" data-lia-message-uid="785049"&gt;
&lt;DIV id="messageView2_1" class="lia-message-view-wrapper lia-js-data-messageUid-785049 lia-component-forums-widget-message-view-two" data-lia-message-uid="785049"&gt;
&lt;DIV class="MessageView lia-message-view-forum-message lia-message-view-display lia-row-standard-read lia-thread-topic lia-message-authored-by-you"&gt;
&lt;DIV class="lia-quilt lia-quilt-forum-message lia-quilt-layout-forum-message"&gt;
&lt;DIV class="lia-quilt-row lia-quilt-row-main"&gt;
&lt;DIV class="lia-quilt-column lia-quilt-column-24 lia-quilt-column-single lia-quilt-column-main"&gt;
&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-single"&gt;
&lt;DIV class="forum-topic-flex-article"&gt;
&lt;DIV class="forum-article"&gt;
&lt;DIV class="forum-post"&gt;
&lt;DIV id="bodyDisplay_1a414c428565f4" class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;Hi, I am creating a scatter plot.&amp;nbsp; I am new to the&amp;nbsp; different types of graphs.&amp;nbsp; When I run the code, I am able to generate the graph, however I am not sure how I can achieve that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. How I can move the treatments in to middle instead . Presently it printing at the both end of x axis.&lt;/P&gt;
&lt;P&gt;2. Please ignore the circle made in green and red. I Just want to show where I want to display the new data points.&lt;/P&gt;
&lt;P&gt;3. I need to display the Mean value right to the trt on x axis and median to the left to the trt ( Make sure these are not in the same x axis of data points or too far from the data points.. How I can achieve this because we did not given any values on X axis.&lt;/P&gt;
&lt;P&gt;Please give suggestions. Thanks.&lt;/P&gt;
&lt;P&gt;Fig 1 How it prints&lt;/P&gt;
&lt;P&gt;fig2 How I want&lt;/P&gt;
&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1639026343295.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66543i057BC58C46DD610E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1639026343295.png" alt="SASuserlot_0-1639026343295.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_1-1639026343312.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66541i7F31F5BE2420621C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_1-1639026343312.png" alt="SASuserlot_1-1639026343312.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;data test;
input Treatment$ trtcode  response;
cards;
trt1 1 5
trt1 1 2
trt1 1 3
trt1 1 5
trt1 1 6
trt1 1 1
trt1 1 3
trt1 1 2
trt1 1 0
trt2 2 2
trt2 2 3
trt2 2 4
trt2 2 6
trt2 2 1
trt2 2 9
trt2 2 10
;
run;
ods graphics on/ width= 8in height= 4in   ;
options orientation = landscape errors = 2 missing = ' ' nofmterr ls = 175 validvarname = upcase nofmterr nobyline 
noquotelenmax ;
ods results on; 
ods listing close; 
ods rtf file = "\&amp;amp;location.\dotted-plot.rtf";
proc sgplot data=test;
 scatter x=treatment y=response / group=trtcode;
run;
ods _all_ close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="kudosButtonV2" class="KudosButton lia-button-image-kudos-wrapper lia-component-kudos-widget-button-version-3 lia-component-kudos-widget-button-horizontal lia-component-kudos-widget-button lia-component-kudos-action lia-component-message-view-widget-kudos-action" data-lia-kudos-id="785049"&gt;
&lt;DIV class="lia-button-image-kudos lia-button-image-kudos-horizontal lia-button-image-kudos-disabled lia-button-image-kudos-not-kudoed lia-button" aria-atomic="true" aria-live="assertive"&gt;
&lt;DIV class="lia-button-image-kudos-give"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="AddMessageTags lia-message-tags lia-component-message-view-widget-tags"&gt;&lt;A id="showAddTag" class="lia-link-navigation add-tag-link" role="button" href="https://communities.sas.com/t5/Graphics-Programming/Modification-in-Scatter-Plot/m-p/785072#" aria-label="Add Tag..." target="_blank"&gt;Add Tags&lt;/A&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="lia-quilt-row lia-quilt-row-footer"&gt;
&lt;DIV class="lia-quilt-column lia-quilt-column-24 lia-quilt-column-single lia-quilt-column-message-footer"&gt;
&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-single"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="lia-component-reply-list"&gt;
&lt;DIV class="linear-message-list message-list"&gt;
&lt;DIV id="lineardisplaymessageviewwrapper_0" class="lia-linear-display-message-view"&gt;
&lt;DIV class=""&gt;
&lt;DIV id="messageview_0" class="lia-panel-message message-uid-785052" data-lia-message-uid="785052"&gt;
&lt;DIV id="messageView2_1_0" class="lia-message-view-wrapper lia-js-data-messageUid-785052 lia-component-forums-widget-message-view-two" data-lia-message-uid="785052"&gt;
&lt;DIV class="MessageView lia-message-view-forum-message lia-message-view-display lia-row-standard-read lia-thread-reply"&gt;
&lt;DIV class="lia-quilt lia-quilt-forum-message lia-quilt-layout-forum-message"&gt;
&lt;DIV class="lia-quilt-row lia-quilt-row-main"&gt;
&lt;DIV class="lia-quilt-column lia-quilt-column-24 lia-quilt-column-single lia-quilt-column-main"&gt;
&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-single"&gt;
&lt;DIV class="forum-topic-flex-article"&gt;
&lt;DIV class="forum-article"&gt;
&lt;DIV class="forum-post"&gt;
&lt;DIV id="bodyDisplay_1a414c45ce50d2" class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;BLOCKQUOTE&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;data test;
input Treatment$ trtcode  response;
cards;
trt1 1 5
trt1 1 2
trt1 1 3
trt1 1 5
trt1 1 6
trt1 1 1
trt1 1 3
trt1 1 2
trt1 1 0
trt2 2 2
trt2 2 3
trt2 2 4
trt2 2 6
trt2 2 1
trt2 2 9
trt2 2 10
;
run;
ods graphics on/ width= 8in height= 4in   ;
options orientation = landscape errors = 2 missing = ' ' nofmterr ls = 175 validvarname = upcase nofmterr nobyline 
noquotelenmax ;
ods results on; 
ods listing close; 
ods rtf file = "\&amp;amp;location.\dotted-plot.rtf";
proc sgplot data=test;
 scatter x=treatment y=response / group=trtcode;
run;
ods _all_ close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Dec 2021 05:06:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/785080#M22402</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2021-12-09T05:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Scatter plot matrix axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/785166#M22407</link>
      <description>&lt;P&gt;Compute the mean and median, then merge the statistics and the data. As for moving the graphics towards the center of the display, use the OFFSETMIN= and OFFSETMAX= options in the XAXIS statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* compute the means and medians for each treatment group */
proc means data=test;
class Treatment;
var response;
output out=MeansOut mean=Mean median=Median;
run;

/* merge the data and the statistics */
data All;
set test MeansOut(where=(_Type_=1));
run;

/* use three data points: one for the data and one for each statistic */
proc sgplot data=All;
 scatter x=treatment y=response;
 scatter x=Treatment y=mean / markerattrs=(symbol=Plus size=16);
 scatter x=Treatment y=median / markerattrs=(symbol=Star size=16);
 xaxis type=discrete offsetmin=0.25 offsetmax=0.25;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Dec 2021 15:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/785166#M22407</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-12-09T15:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Scatter plot matrix axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/785175#M22408</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;. Thanks for&amp;nbsp; solution. I really appreciate it. However I want to do display the mean median on each side of the data points ( response) on x- axis, no same axis of the data points ( to avoid overlapping).&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 16:15:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/785175#M22408</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2021-12-09T16:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Scatter plot matrix axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/785178#M22409</link>
      <description>&lt;P&gt;use the DISCRETEOFFSET= option&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=All;
 scatter x=treatment y=response;
 scatter x=Treatment y=mean / markerattrs=(symbol=Plus size=16) discreteoffset=-0.1 ;
 scatter x=Treatment y=median / markerattrs=(symbol=Star size=16) discreteoffset=0.1;
 xaxis type=discrete offsetmin=0.25 offsetmax=0.25;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Dec 2021 16:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/785178#M22409</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-12-09T16:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Scatter plot matrix axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/785184#M22410</link>
      <description>Perfect. Thank you very much.</description>
      <pubDate>Thu, 09 Dec 2021 16:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Scatter-plot-matrix-axes/m-p/785184#M22410</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2021-12-09T16:32:39Z</dc:date>
    </item>
  </channel>
</rss>

