Hello, is there a way, other than trial and error, to get the scale of SAS-GRAPH or SG- graphics X and Y axes to be equal?
PG
For example ...
In the following graphs, I use:
axis1 length=2.3in offset=(0,0) order=(0 to 60 by 10) minor=none;
axis2 length=2.3in offset=(0,0) order=(0 to 60 by 10) minor=none;
And then in the gplot I use them as ...
vaxis=axis1 haxis=axis2
Which produces these nice plots with proportional axes:
http://robslink.com/SAS/democd52/gas_class_2012.htm
for the full code, see...
Thanks!
Very nice graphs! But as usual, a lot of tinkering required. One has to figure out the X and Y ranges, decide on tick mark values and translate that into physical dimensions. Quite a bit more trouble than I got used to expect since the advent of SG- procedures... and incompatible with BY processing unless one wants UNIFORM graphs.
I don't know what the demand would be for a feature such as XYRATIO=, but I am sure any improvement in that direction would promote the proper visual representation of related units.
PG
I put in a request for this enhancement a while back - I'll add a note to that request to let developers know you're also interested.
S0307966 NewFeature:GPLOT SUGGESTION:
ADD OPTION TO PRESERVE 1/1 ASPECT RATIO OF THE AXES
Great! Thank you Robert. GPLOT is only one place where this would be useful, GCONTOUR when used in conjunction with geotatistics procedures, for example, could also benefit from that option. - PG
With SAS 9.2 you can use GTL with LAYOUT OVERLAYEQUATED to create a graph with a real 1:1 ratio. Here is an example of the usage of such a layout with a SCATTERPLOT statement: In this case the LINEPARM with slope=1 is actually a 45 degree line in the graph.
proc template;
define statgraph equated;
begingraph;
entrytitle 'City and Highway Mileage';
layout overlayequated / equatetype=square;
scatterplot x=mpg_highway y=mpg_city;
lineparm x=10 y=10 slope=1 / curvelabel='Slope=1.0';
endlayout;
endgraph;
end;
run;
ods graphics / reset width=3in height=3.2in imagename='Equated';
proc sgrender data=sashelp.cars template=equated;
run;
Here is another example of usage of the Equated layout: Map Overlays. LAYOUT OVERLAYEQUATED has three different EquateType of FIT, SQUARE and EQUATE. You can make the scales equal, but there not a way to have guaranteed equal lengths.
Thank you Sanjay! Which of GPLOT or SGPLOT will offer this as a simple option first?
PG
My vote is on SGPLOT because I've been advocating for this for a while and I thik they're getting tired of hearing me complain.
Rick
It will be in the SG family, but it is not as simple as adding to SGPLOT. We need to consider if this should really be a separate procedure, since many of the options (and statements) avaialble in SGPLOT will not be valid for this case.
We are considering a SGEQUATED procedure. This will only plots with allow numeric (linear) values on the axes, and many axis options will be common (to X & Y), and will need a EquatedAxis statement. There are benefits to separating it out (cleaner syntax and implementation). I don't yet see the benefit of adding this into SGPLOT.
Do you see any benefits of adding this feature into the SGPLOTprocedure? In GTL, this is a whole separate layout container. Opinions?
From my casual user perspective, this feature would simply affect the scaling of the axes, and only when they are both continuous and of the same type (linear, log or time). I don't see what else would be affected. I enjoy very much the (apperent) simplicity of statistical graphics procedures. I trust you guys to keep them that way, as much as possible. Thanks!
PG
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.