krige2d plotting

Reply
Frequent Contributor
Posts: 124

krige2d plotting

Hi,

I have issues plotting the results from the krige2d procedure.

I found out that the plots differ depending from the manner the grid is defined

1st I define the grid with "x" and "y" options:

ODS GRAPHICS ON;

proc krige2d data=populated

  outest=KRIGE2DED

  plots=(

  prediction(fill=pred line=none obs=none )

  );

  coordinates xc=x yc=y;

  predict var=CasesPer100k radius=100;

  model scale=116 range=67105 nugget=178 form=spherical;

  grid x=&minx to &maxx by &gridstep y=&miny to &maxy by &gridstep;

  run; quit;

ods graphics off;

this gives me fig1.png, it's good but I would like to cut out the country and to show the country frontiers with a black line so I thought to use the griddata option:

proc sql;

  select min(x), max(x), min(y), max(y)

  into : minx,

  : maxx,

  : miny,

  : maxy

  from belgium;

  run;quit;

%let gridstep = 20000;

data gridbelgium;

  do x = round(&minx,&gridstep) to round(&maxx,&gridstep) by &gridstep;

  do y = round(&miny,&gridstep) to round(&maxy,&gridstep)-&gridstep by &gridstep;

  output;

  end;

  output;

  end;

  run;

proc ginside data=gridbelgium map=belgium out=gridbelgium;

  id country;

  run;quit;

data gridbelgium;

  set gridbelgium;

  where country is not missing;

  run;

ODS GRAPHICS ON;

proc krige2d data=populated

  outest=KRIGE2DED

  plots=(

  observations

  prediction

  prediction(fill=pred line=none obs=none)

  /*prediction(fill=se line=se obs=linegrad)*/

  );

  coordinates xc=x yc=y;

  predict var=CasesPer100k radius=100;

  model scale=116 range=67105 nugget=178 form=spherical;

  *grid x=&minx to &maxx by 5000 y=&miny to &maxy by 5000;

  grid griddata=gridbelgium xc=x yc=y;

  run; quit;

ods graphics off;

This give me another kind of graph (fig2.png) with not color fills and big grid triangles that quickly recovers the whole map in black.

Does anyone has expérience with this and know how to obtain just a continuous color map on the country only ?

Thanks,


fig1.png
fig2.png
Occasional Contributor
Posts: 18

Re: krige2d plotting

Hi Mathias,

In fact, the aim of proc krige2d is not to drawn a map, but analyse spatial data (kriging).

For me, your problem is more about how could you plot these data.

It is better to look (and post) on SAS/GRAPH community rather than here. You could also read these two links (first, it is the output, and the second, it is the codes) :

http://robslink.com/SAS/democd5/topo.htm

http://robslink.com/SAS/democd5/topo_info.htm


I hope it will help you,


JB

Frequent Contributor
Posts: 124

Re: krige2d plotting

You are right, its a plotting issue.

Now I create the plots with ods graphics.

I think robslink has a chloropleth with a very little polygons. He does not draw the boundaries and you get the impression that it is continuous.

We don't have such a low level of polygons in belgium to do the same.

Occasional Contributor
Posts: 18

Re: krige2d plotting

No... Robslink do not use small polygones spread over USA... He create an annotate dataset to plot tons of dot with different colors... It is smart idea but the output is not very smooth...

Ask a Question
Discussion stats
  • 3 replies
  • 287 views
  • 3 likes
  • 2 in conversation