turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- SAS Graph - Axis Question

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-02-2011 12:18 PM

Guys -

If i have a Graph with values say;

a

60

70

60

100

120

110

I plot these on a bar graph with a on the Y Axis - is there a way i can format the axis to show the minimum at 40?

IS this possible at all?

If i have a Graph with values say;

a

60

70

60

100

120

110

I plot these on a bar graph with a on the Y Axis - is there a way i can format the axis to show the minimum at 40?

IS this possible at all?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ace2011

06-02-2011 01:12 PM

By default, gchart included zero in the response axis, and it is generally the "best practice" to do that.

SAS does provide a way to over-ride the default with an axis statement (but make sure this is really/really/really sure this is what you want to do, and is a good way to display your data, before doing it!)

data foo;

barnum=_n_;

input a;

datalines;

60

70

60

100

120

110

;

run;

axis1 order=(40 to 150 by 10);

proc gchart data=foo;

vbar barnum / discrete

type=sum sumvar=a raxis=axis1;

run;

SAS does provide a way to over-ride the default with an axis statement (but make sure this is really/really/really sure this is what you want to do, and is a good way to display your data, before doing it!)

data foo;

barnum=_n_;

input a;

datalines;

60

70

60

100

120

110

;

run;

axis1 order=(40 to 150 by 10);

proc gchart data=foo;

vbar barnum / discrete

type=sum sumvar=a raxis=axis1;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ace2011

06-02-2011 05:26 PM

Just in case your using SGPLOT for this, I modified Robert's example to show you how you would do it.

[pre]

data foo;

barnum=_n_;

input a;

datalines;

60

70

60

100

120

110

;

run;

proc sgplot data=foo;

yaxis min=40;

vbar barnum / response=a;

run;

[/pre]

[pre]

data foo;

barnum=_n_;

input a;

datalines;

60

70

60

100

120

110

;

run;

proc sgplot data=foo;

yaxis min=40;

vbar barnum / response=a;

run;

[/pre]

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ace2011

06-03-2011 03:04 PM

Ace:

Rob is letting you off easy with respect to the bar chart not startng at zero. Here's why it must start at zero:

Bar Chart Value Axis Scale Must Include Zero

by Jon Peltier

Wednesday, March 30th, 2011

Peltier Technical Services, Inc., Copyright © 2011.

Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

http://peltiertech.com/WordPress/bar-chart-value-axis-scale-must-include-zero/#ixzz1OF1FUIkt.

Remember the cardinal rule about bar charts and axis scales? Because we judge the values in a bar chart by the lengths of the bars, not by the positions of the ends of the bars, the axis scale must include zero. By chopping off the bottoms of the bars, we increase the resolution of the chart, but we distort the apparent values encoded by the bars. I’ll repeat: The value axis of a bar chart must include the value zero.

Bill

Rob is letting you off easy with respect to the bar chart not startng at zero. Here's why it must start at zero:

Bar Chart Value Axis Scale Must Include Zero

by Jon Peltier

Wednesday, March 30th, 2011

Peltier Technical Services, Inc., Copyright © 2011.

Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

http://peltiertech.com/WordPress/bar-chart-value-axis-scale-must-include-zero/#ixzz1OF1FUIkt.

Remember the cardinal rule about bar charts and axis scales? Because we judge the values in a bar chart by the lengths of the bars, not by the positions of the ends of the bars, the axis scale must include zero. By chopping off the bottoms of the bars, we increase the resolution of the chart, but we distort the apparent values encoded by the bars. I’ll repeat: The value axis of a bar chart must include the value zero.

Bill