<?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: What should I do when I do not want the axis should not be drawn to scale in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61392#M2051</link>
    <description>Here's a slight variation of what RickM was suggesting - except rather than hard-coding all the axis values, I create a data-driven user-defined format (on-the-fly).  Hard-coding all the values is a bit cumbersome, and if your data changes then the hard-coded values are incorrect, which could compromise the data integrity of the graph.&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
input x y;&lt;BR /&gt;
datalines;&lt;BR /&gt;
400    2&lt;BR /&gt;
92345  3&lt;BR /&gt;
96457  2&lt;BR /&gt;
97876  4&lt;BR /&gt;
99876  3&lt;BR /&gt;
100456 3&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data a; set a;&lt;BR /&gt;
data_order=_n_;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data control; set a (rename = ( data_order=start x=label));&lt;BR /&gt;
fmtname = 'my_fmt';&lt;BR /&gt;
type = 'N';&lt;BR /&gt;
end = START;&lt;BR /&gt;
run;&lt;BR /&gt;
proc format lib=work cntlin=control;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
symbol1 value=dot height=3 interpol=join color=red;&lt;BR /&gt;
&lt;BR /&gt;
axis1 minor=none offset=(3,3);&lt;BR /&gt;
axis2 label=('X') minor=none offset=(3,3);&lt;BR /&gt;
&lt;BR /&gt;
proc gplot data=a;&lt;BR /&gt;
format data_order my_fmt.;&lt;BR /&gt;
plot y*data_order / vaxis=axis1 haxis=axis2;&lt;BR /&gt;
run;</description>
    <pubDate>Tue, 23 Feb 2010 16:25:31 GMT</pubDate>
    <dc:creator>GraphGuy</dc:creator>
    <dc:date>2010-02-23T16:25:31Z</dc:date>
    <item>
      <title>What should I do when I do not want the axis should not be drawn to scale</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61389#M2048</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I am a new user to SAS/GRAPH. I have a requirement where I need to plot variables X and variable Y. The values in variable X are something like 400, 92345, 96457, 97876, 99876, 100456 etc etc..... Now when I use the normal SAS code the horizontal x axis is drawn to scale i.e I get a huge space between the first datapoint and the 2nd datapoint and the remaining datapoints are very close to each other. I need the chart in such a way that only the values of the datapoints are plotted and all of them are equally spaced ( Just like how we get when using Excel spreadhseet). Any help will be greatly apperciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Sohail</description>
      <pubDate>Tue, 23 Feb 2010 15:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61389#M2048</guid>
      <dc:creator>Soha</dc:creator>
      <dc:date>2010-02-23T15:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: What should I do when I do not want the axis should not be drawn to scale</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61390#M2049</link>
      <description>Sorry about the confusing Subject line. It should read "What should I do when I do not want the axis to be drawn to scale"</description>
      <pubDate>Tue, 23 Feb 2010 15:29:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61390#M2049</guid>
      <dc:creator>Soha</dc:creator>
      <dc:date>2010-02-23T15:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: What should I do when I do not want the axis should not be drawn to scale</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61391#M2050</link>
      <description>You could do something like creating an index variable that goes from 1 to n to replace x and then in an axis statement use the value= option to specify the major tick marks as the actual x-values.  This is a bit tedious and involves a bit of hard coding but if the data set is relatively small and this is a one time graph it may be a good enough quick fix.  &lt;BR /&gt;
&lt;BR /&gt;
Annotated data sets would probably be better but I don't know much about how to use them.</description>
      <pubDate>Tue, 23 Feb 2010 15:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61391#M2050</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2010-02-23T15:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: What should I do when I do not want the axis should not be drawn to scale</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61392#M2051</link>
      <description>Here's a slight variation of what RickM was suggesting - except rather than hard-coding all the axis values, I create a data-driven user-defined format (on-the-fly).  Hard-coding all the values is a bit cumbersome, and if your data changes then the hard-coded values are incorrect, which could compromise the data integrity of the graph.&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
input x y;&lt;BR /&gt;
datalines;&lt;BR /&gt;
400    2&lt;BR /&gt;
92345  3&lt;BR /&gt;
96457  2&lt;BR /&gt;
97876  4&lt;BR /&gt;
99876  3&lt;BR /&gt;
100456 3&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data a; set a;&lt;BR /&gt;
data_order=_n_;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data control; set a (rename = ( data_order=start x=label));&lt;BR /&gt;
fmtname = 'my_fmt';&lt;BR /&gt;
type = 'N';&lt;BR /&gt;
end = START;&lt;BR /&gt;
run;&lt;BR /&gt;
proc format lib=work cntlin=control;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
symbol1 value=dot height=3 interpol=join color=red;&lt;BR /&gt;
&lt;BR /&gt;
axis1 minor=none offset=(3,3);&lt;BR /&gt;
axis2 label=('X') minor=none offset=(3,3);&lt;BR /&gt;
&lt;BR /&gt;
proc gplot data=a;&lt;BR /&gt;
format data_order my_fmt.;&lt;BR /&gt;
plot y*data_order / vaxis=axis1 haxis=axis2;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 23 Feb 2010 16:25:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61392#M2051</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2010-02-23T16:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: What should I do when I do not want the axis should not be drawn to scale</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61393#M2052</link>
      <description>If you are using SAS 9.2, another option is to use PROC SGPLOT and set the axis type to be discrete:&lt;BR /&gt;
&lt;BR /&gt;
proc sgplot data=whatever;&lt;BR /&gt;
xaxis type=discrete;&lt;BR /&gt;
series x=numvar1 y=numvar2;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
--Dan</description>
      <pubDate>Tue, 23 Feb 2010 17:36:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61393#M2052</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2010-02-23T17:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: What should I do when I do not want the axis should not be drawn to scale</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61394#M2053</link>
      <description>A simpler method for those of use with no access to the SG procs, would be to make X a character.  Notice that numeric format COMMA is right justified so values have the correct order.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data a;&lt;BR /&gt;
   input x y;&lt;BR /&gt;
   cx = put(x,comma10.);&lt;BR /&gt;
datalines;&lt;BR /&gt;
400 2&lt;BR /&gt;
92345 3&lt;BR /&gt;
96457 2&lt;BR /&gt;
97876 4&lt;BR /&gt;
99876 3&lt;BR /&gt;
100456 3&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc gplot;&lt;BR /&gt;
   plot y * cx;&lt;BR /&gt;
   run;&lt;BR /&gt;
   quit;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 23 Feb 2010 18:35:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61394#M2053</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-02-23T18:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: What should I do when I do not want the axis should not be drawn to scale</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61395#M2054</link>
      <description>Thanks a lot everyone. I too changed it to character and it worked as I wanted. Thanks for the help.</description>
      <pubDate>Tue, 23 Feb 2010 18:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61395#M2054</guid>
      <dc:creator>Soha</dc:creator>
      <dc:date>2010-02-23T18:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: What should I do when I do not want the axis should not be drawn to scale</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61396#M2055</link>
      <description>Robert;&lt;BR /&gt;
&lt;BR /&gt;
A nice trick, but a problem graph results.  The integrity of the x axis is compromised - in the same way as when bars don't start at zero.  I'm not a proponent of a broken scale, but this might be a use for one.  Either that or leave out the 400 point and just post a note about it.  And then the most important question - is this even the correct display mechanism for the data at hand?</description>
      <pubDate>Tue, 23 Feb 2010 21:00:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/What-should-I-do-when-I-do-not-want-the-axis-should-not-be-drawn/m-p/61396#M2055</guid>
      <dc:creator>Bill</dc:creator>
      <dc:date>2010-02-23T21:00:21Z</dc:date>
    </item>
  </channel>
</rss>

