BookmarkSubscribeRSS Feed
kathy
Calcite | Level 5

Dear there,

I am trying to add some text and a circle (oval) in a scatter plot coming out of SGPLOT, but just could not make it work .  Can someone help?  Thanks,

Kathy

3 REPLIES 3
Jay54
Meteorite | Level 14

Here is an article on SGANNOTATE by Dan Heath showing how to add Text and other figures such as OVALS, etc.  Note, the drawing context can be GRAPH, LAYOUT, WALL or DATA and the drawing coordinates can be in PIXEL, PERCENT or VALUE.  DRAWSPACE is a combination of the context and the coordinates, such as GRAPHPERCENT, DATAVALUE, etc.

Jay54
Meteorite | Level 14

In your program, oval needs to use X1, Y1, HEIGHT and WIDTH columns.  Also, when you append the OVAL data set to ANNO, the "Height" and "Width" columns from "OVAL data set are being dropped.  Using a simple set statement with both data set works better:

data anno;


retain drawspace "layoutpercent" linecolor "blue";
input function $ x1 y1 x2 y2 shape $ direction $;
datalines;
arrow 32 25 42 25 barbed in
arrow 65 25 75 15 barbed out
;
run;

data oval;
     retain drawspace "layoutpercent" linecolor "blue";
  input function $ height width x1 y1;
  datalines;
  oval 20 30 70 15
;
run;

data anno2;
  set anno oval;
  run;

proc sgplot data=enso noautolegend tmplout="test1" sganno=anno2;

      title 'Atmospheric Pressure Differences Between '

            'Easter Island and Darwin, Australia';

      pbspline y=pressure x=year;

   run;

SGPlot9.png

kathy
Calcite | Level 5

Thank you so much Sanjey.  It worked.  You are the true master.  Smiley Happy

Regards,

Kathy

SAS INNOVATE 2024

innovate-wordmarks-white-horiz.png

SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.

Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!

Submit your idea!

How to Concatenate Values

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1139 views
  • 0 likes
  • 2 in conversation