07-28-2017 07:36 AM
Hi all, I'm trying to use a contour and a scatter plot to evaluate the goodness of fit from an nalyses in a x,y,z plane. Here is the graph I try to make.
The graph works nice, but I cannot find any options that helps me control the resolution of the color in in the contour or the scatter plot that ensures the same color gradient for both plots. Also I would like te contour plot to be more subdued to be able to see the points better. I can't find a transperancy option.
Is there an option to control the length of the color range? If not does anybody have a possible work around?
Below are the data and program that produce the plot.
/*The data*/ data WORK.BASE_FOR_PLOT; infile datalines dsd truncover; input X:BEST8. Y:BEST9. PORE:BEST18. p_pore:32.; datalines4; 510962.9,6267990.3,0.22282375395298,0.2307076249 511862.6,6268799.1,0.27357468008995,0.2523781993 512232.1,6268949.1,0.35161769390106,0.3098804767 512752.2,6269476.7,0.36520266532897,0.3213823473 512913.4,6269503.4,0.38137403130531,0.3217868261 512447.8,6268559.5,0.3382844030857,0.3205405664 513538.3,6266015.3,0.37465354800224,0.3408979045 513724.2,6268777.3,0.35254389047622,0.3567335985 515122.8,6268715.5,0.35862925648689,0.3144387316 513454.9,6267035.7,0.38109946250915,0.3361282979 515248.3,6268260.9,0.30638554692268,0.299910509 511550.4,6267946.5,0.26178368926048,0.2431489494 512573.6,6270566.4,0.25007385015487,0.2552115468 514316.2,6269256.7,0.35346233844757,0.3359772149 511474,6268855.6,0.21668280661106,0.2163187013 514354.9,6268117.8,0.30407819151878,0.3432910599 513575.4,6267783.8,0.3202120065689,0.3461766186 513847.8,6266189.5,0.36615779995918,0.346116315 512623.1,6266085.5,0.30052587389946,0.3341025048 511763.5,6266789,0.35309532284736,0.3037241409 513138.2,6265865.2,0.36843499541282,0.3477953454 514361.4,6266269.5,0.40372323989868,0.3450572858 512950.4,6268570.4,0.34187161922454,0.3329606009 514313.4,6263117.9,0.31319367885589,0.3184788238 513877.4,6263281.1,0.33906409144401,0.3271859406 514659.2,6265274.7,0.33385989069938,0.3215018567 514690.3,6264962.4,0.35012233257293,0.3110176732 512048.5,6267434.2,0.29989910125732,0.3193181294 514802.1,6263657.3,0.28002780675888,0.2837553408 514307,6264777.9,0.33080494403839,0.3312746238 513995.2,6265515.8,0.36222431063652,0.357686153 514134.2,6263882.9,0.32762962579727,0.3324178714 513609.6,6264907.5,0.33123889565467,0.3441397059 512268.1,6265142.5,0.28782638907432,0.2793788645 515054.8,6266072,0.29052707552909,0.3207727136 513621.9,6263346.3,0.34248441457748,0.3273684351 515037.8,6265421.7,0.30971908569335,0.297150147 514739.8,6262476.8,0.27110311388969,0.2896442858 515073.7,6263813.1,0.2622839808464,0.2651962247 514560.7,6262775.3,0.29352673888206,0.3088335072 513528.5,6263001.1,0.35366284847259,0.3156993185 514319.9,6261888.7,0.34494203329086,0.2945361812 513148.7,6263950.3,0.34878042340278,0.3211947839 513973,6262700.7,0.3503605723381,0.2826350696 514016.6,6262499,0.31855052709579,0.2679300059 514987.1,6264661.1,0.28670227527618,0.2823153748 512295,6265824.2,0.35597771406173,0.2906026286 514457.6,6267535.6,0.36591538786888,0.3091618026 512155.6,6266628.3,0.2769296169281,0.3041260564 513546.5,6269006.5,0.38172376155853,0.3414136668 514419.2,6265869.2,0.33722785115242,0.3336146078 514264,6267007.2,0.35775768756866,0.3421299535 513064.6,6267420.6,0.38768827915191,0.3380744858 513780.3,6264189.8,0.37368395924568,0.3060198036 513698.6,6265984.5,0.37755236029624,0.3455915963 515083.6,6267742.6,0.34545290470123,0.330071644 513235.2,6265346,0.37991404533386,0.3471280994 514896.3,6264839.3,0.36032208800315,0.2907656787 513380.6,6265351.5,0.38723111152648,0.3480921619 513996.4,6264844.7,0.37484994530677,0.3553275657 514208.1,6265983.8,0.3824268579483,0.3451911486 514316.6,6262647.5,0.28165584802627,0.3035630648 514437.1,6262578.9,0.27437278628349,0.295279495 514114.8,6266774.2,0.40394061803817,0.3551937996 514074.8,6262031.1,0.32982367277145,0.3063840293 514832.7,6263059.5,0.29684400558471,0.2682195855 513174.8,6265679.8,0.35718873143196,0.3467538049 ;;;; /*Producing the plot*/ ODS GRAPHICS on / imagemap; proc template; define statgraph cont_scatt; begingraph; layout overlay; contourplotparm x=x y=y z=p_pore / gridded=false name="cont" colormodel=(blue pink green) nhint = 12 ; scatterplot x=x y=y / markercolorgradient=pore markerattrs=(symbol=circlefilled size=20 px) name="scatter" colormodel=(blue pink green); continuouslegend "scatter" / title='Actual pore (points)' location=outside halign=left; continuouslegend "cont" / title='Modelled pore (contour)'; endlayout; endgraph; end; run; proc sgrender data=base_for_plot template=cont_scatt; format p_pore 5.3; run;
07-28-2017 11:56 AM
I would start by changing the color model on the contour to something like
colormodel=(lightblue verylightred lightgreen)
There are a host of different ways to designate colors and sometimes the CNS system provides easy modifications though "pink" isn't one of the choices.
07-31-2017 01:34 AM
Thanks ballardw, the main problems is to get the color ranges for the two plots the same. The actual color choice will be changed in the final presentation.
07-28-2017 12:33 PM
There are two issues here.
If the contour range was greater, you could have extracted the smallest and largest value, and created a RangeAttrMap using these values for the end colors. Then, you could make the Scatter plot adhere to this range using MarkerColorGradient=rattrvar, where rattrvar is associated with the response variable and the range attr map.
But, since your scatter range is wider, you may somehow need to expand the response data range for the contour data.
07-31-2017 01:32 AM
can you expand some of the reason why Range Attributes can't be used for contours. Another possibility for this problem would be to use a 3D surface for showing the model and a 3d scatter for the actuals. I have seen that there has been no demand for 3D scatter. I find this strange.
What would be the appropriate way to request a 3d scatetr option and possibly that contour plots would honor ranges and transperancy?
I did play a bit with Range attrmaps after I posted this. Making the scatter plots range smaller give a nice visual but hides some of the important features. The nature of contour plots make it hard to insert dummy values at min max of the actual. In sactter plot you could always cheated and plottred extra symbols later to be overplotted by background.
Thanks for your tips on graphically speaking.
07-31-2017 05:41 PM
Dan and I experimented a bit with your data. I was not geting good match between the scatter color (raw data) and the contours. We then first ran G3GRID with JOIN option, and then merged the data with the original data, to get the following result. Then we ran the GTL Contour with GRIDDED=TRUE, meaning data is already gridded. This replaces the gridding algorithm in the contour statement. With sparse data, the results vary a lot with the type of gridding algorithm you use.
This seems a better match between the scatter color and the contour color. This is with both Contour and Scatter using PORE. If you use different variables, you still need to match up the data ranges.
08-01-2017 01:43 AM
Thanks Sanjay and Dan.
The out of the box options that give two different color ranges that are similar is OK when you are doing the development. It is when you are to make the presentation quality data that you need theses similar. In your example they are so similar that you can get away with just showing one of these.
In the analyses that I'm doing the plan was all along to use a better method for creating the contour plot probably TPSpline. However the lazy option of no gridded in contourplot was really nice for playing with the data.
Having worked a bit more with this and playing some with range attribute it would be really good to to have range support for contours. In for instance this case there are values of PORE that are really important to us. I can make these consistent in most plots but not a contour.
Since there is no 3dscatter in GTL I can't use a 3dsurface and overlay with a 3dscatter. I theory it should be possible to do this with two g3d plots. However in practice the greplay and overlay would probably make it chunky. Controlling the color in g3d means extencive programming and testing of color range lookup tables. So a more full option in GTL would be nice.
Again thanks for your help and comments.