10-29-2015 08:46 AM - edited 10-29-2015 08:47 AM
I'm trying to create a normal X,Y plot using proc gplot and spline as interpoation. I found in more than one case that the generated curves are some how broken (not fully connected) which should not be the case. I also changed spline (interpol = SMn) and same thing occurs. I attached the dataset which includes the data as well as a PDF file that includes the generated (broken) curves. Please have a look to both Red and Green curves as they're not fully connected. Appreciate your assistance.
title ' ';
PROC GPLOT DATA= MyData;
symbol1 interpol=JOIN color=blue line=1 width=3;
symbol2 interpol=SPLINE color=Red line=1 width=3;
symbol3 interpol=SPLINE color=Green line=1 width=3;
axis1 order=(0 to 1 by 0.1) offset=(2,2) label= ('X-Axis');
axis2 order=(0 to 1 by 0.1) offset=(2,2) label= ('Y-Axis');
legend1 value= ('Blue Curve' 'Red Curve' 'Green Curve');
plot (Blue_Curve Red_Curve Green_Curve)*(Blue_Curve) /
overlay legend= LEGEND1 autohref haxis=axis1 hminor=1 vaxis=axis2 vminor=1;
10-29-2015 11:26 AM
I didn't open the data but the chart indicates it is very likely that the data for you Y values exceeds 1. Since your Y axis limits the upper value to 1 any value above that is truncated from the display.
10-29-2015 11:56 AM
Unfortunately, this is not the case.Here is the data in case you were unable to open it:
10-29-2015 01:46 PM - edited 10-29-2015 01:47 PM
You're absolutely right! This is my bad! I should have thought about that!
Anyhow, do you know if there is a way to define the range in axis statement (order=) automatically without any manually intervention? Therefore, SAS checks the highest and lowest values SPLINE would generate and sets them automatically?
10-29-2015 06:12 PM
Since spline generates curves outside the data and if the data is obnoxious enough might be quite variable from the actual input data range I would fall back on why I am attempting to control the y axis appearance at all.
If I am just trying to make a "clean" appearing axis then possibly I would consider something that controls the number of tick marks like Major = 10 and Minor=none and let SAS pick appropriate values.
If I am trying to provide consistent axis for multiple graphs then either set the range large enough for the largest graph or possibly UNIFORM would work if you make all the graphs in the same pass through GPLOT.
Another quite different approach would be to calculate the values to be plotted (not a trivial exercise), determine the max and min y from that data and use that to set likely max/min value for an axis statement.
Or possibly consider a different smoothing option but some of those will have the same issue. Interpol = SMnn and experiment with values of nn between 01 and 99 to see which you like. This I believe is less likey to not exceed the data with largish values of nn, but no promises.
11-01-2015 12:23 AM - edited 11-01-2015 12:38 AM
Sorry for the late response.
I tried not to constrol the appearance of Y-axis but felt in the same issue. I removed the (order=) keyword from axis statement. The graph gave a range of (0-1) for each axis (X and Y) which I think is taken from the data points. Hence, once gain, SPLINE generated out of range (relative to data points) points whihc caused the curve to break in more than one place on the edges!