DATA Step, Macro, Functions and more

Popup with Reference Line GPLOT

Reply
New Contributor
Posts: 2

Popup with Reference Line GPLOT

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;

 

 class.png

 

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!

PROC Star
Posts: 1,410

Re: Popup with Reference Line GPLOT

Posted in reply to Suzanevara

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;
PROC Star
Posts: 1,410

Re: Popup with Reference Line GPLOT

Posted in reply to Suzanevara

Also, why is it essential that you continue with a GPLOT? Almost everyone in here will advise you to use the newer PROC SGPLOT?

Respected Advisor
Posts: 3,293

Re: Popup with Reference Line GPLOT


@draycut 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.

--
Paige Miller
PROC Star
Posts: 1,410

Re: Popup with Reference Line GPLOT

Posted in reply to PaigeMiller

Strong reasoning indeed @PaigeMiller Smiley Happy

New Contributor
Posts: 2

Re: Popup with Reference Line GPLOT

Posted in reply to 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.

Respected Advisor
Posts: 3,293

Re: Popup with Reference Line GPLOT

Posted in reply to Suzanevara

@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.

--
Paige Miller
Respected Advisor
Posts: 3,293

Re: Popup with Reference Line GPLOT

[ Edited ]
Posted in reply to Suzanevara

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?

--
Paige Miller
Ask a Question
Discussion stats
  • 7 replies
  • 72 views
  • 0 likes
  • 3 in conversation