Hi All,
I would like to know if it's possible to display a popup window while hovering the graph with the mouse on a reference line on a Gplot (it is essential that I continue with a Gplot).
Here's my code and my graph:
proc sql noprint;
select catx('','"',Name,'"') as ListName into :NameRefline separated by " " from sashelp.class where Height GT 65;
quit;
%put &NameRefline;
goptions xpixels=1200 ypixels=675;
proc gplot data=SASHELP.CLASS;
plot Name*Height=Sex / vref=&NameRefline cvref=orange;
run;
The idea here is to show the Weight of the people with the refline in a popup. I don't want to put it on the graph because the graph will be difficult to read. I hope I'm clear enough. Thanks!
I'm not sure if this works with PROC GPLOT, but with PROC SGPLOT you can use the IMAGEMAP Option to the ODS Graphics statement like this
ods graphics on / imagemap;
proc sgplot data=sashelp.class;
scatter x=height y=weight;
refline 60 / axis=x;
run;
Also, why is it essential that you continue with a GPLOT? Almost everyone in here will advise you to use the newer PROC SGPLOT?
@PeterClemmensen wrote:
Also, why is it essential that you continue with a GPLOT? Almost everyone in here will advise you to use the newer PROC SGPLOT?
Why? Because this is the second almost identical question today about GPLOT (https://communities.sas.com/t5/SAS-GRAPH-and-ODS-Graphics/PROC-GPLOT-and-popup/m-p/481460#M16627) by two different people, strongly suggesting this is a homework assignment.
Strong reasoning indeed @PaigeMiller 🙂
Why a Gplot because at work I use a project with a lot of macros and it generates lots of graphs automatically. We cannot change right now the way we work.
@Suzanevara wrote:
Why a Gplot because at work I use a project with a lot of macros and it generates lots of graphs automatically. We cannot change right now the way we work.
Ok, then suggestions were given above about other solutions using GPLOT than a pop-up on a reference line, which is not possible as far as I know.
I am not aware of any way to produce tool-tips for reference lines using GPLOT, nor am I aware of any way to produce tool-tips for reference lines using the annotate facility. You could create a tool-tip for the data point (not the reference line).
Of course, I must ask ... why does the solution have to be a tool-tip (or pop-up as you call it)? Why not do a bubble plot which shows the weight instead of a regular scatterplot?
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.