Sample 48672: Change the bubble color based on the value of a variable
The sample code on the
Full Code tab illustrates how to use the Annotate facility to change the color of PROC GPLOT bubble plots based on the value of a variable.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
The sample code below illustrates how to use the Annotate facility to change the color of PROC GPLOT bubble plots based on the value of a variable.
/* Set the graphics environment */
goptions reset=all border cback=white htitle=12pt htext=10pt;
/* Create sample data set ONE */
data one;
length col $8;
do zvar=1 to 3;
do xvar=1 to 10;
yvar=ranuni(0);
if yvar > 0 and yvar <= .33 then col='blue';
else if yvar > .33 and yvar <= .66 then col='green';
else col='red';
output;
end;
end;
run;
/* Create annotate data set ANNO. Use the PIE function */
/* to generate bubbles of different colors. */
data anno;
set one;
retain xsys ysys '2' zsys '4' when 'a' style 'empty' rotate 360;
function='pie'; x=xvar; y=yvar; size=zvar/4; color=col; output;
run;
/* Generate the graph */
title 'Bubble Color Based on a Variable Value';
proc gplot data=one;
bubble yvar*xvar=zvar / haxis=axis1 bcolor=white annotate=anno;
axis1 offset=(2,2)pct;
run;
quit;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample uses the Annotate facility to change the color of PROC GPLOT bubble plots based on the value of a variable.
Date Modified: | 2012-12-18 14:15:56 |
Date Created: | 2012-12-12 16:25:33 |
Operating System and Release Information
SAS System | N/A | Aster Data nCluster on Linux x64 | 9.3 TS1M1 | |
DB2 Universal Database on AIX | 9.3 TS1M1 | |
DB2 Universal Database on Linux x64 | 9.3 TS1M1 | |
Greenplum on Linux x64 | 9.3 TS1M1 | |
Netezza TwinFin 32bit blade | 9.3 TS1M1 | |
Netezza TwinFin 32-bit SMP Hosts | 9.3 TS1M1 | |
Netezza TwinFin 64-bit S-Blades | 9.3 TS1M1 | |
Netezza TwinFin 64-bit SMP Hosts | 9.3 TS1M1 | |
Teradata on Linux | 9.3 TS1M1 | |
z/OS | 9.3 TS1M1 | |
Z64 | 9.3 TS1M1 | |
Microsoft Windows Server 2003 for x64 | 9.3 TS1M1 | |
Microsoft Windows Server 2008 for x64 | 9.3 TS1M1 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.3 TS1M1 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.3 TS1M1 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.3 TS1M1 | |
Microsoft Windows XP 64-bit Edition | 9.3 TS1M1 | |
Microsoft® Windows® for x64 | 9.3 TS1M1 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.3 TS1M1 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.3 TS1M1 | |
Microsoft Windows Server 2003 Standard Edition | 9.3 TS1M1 | |
Microsoft Windows Server 2008 | 9.3 TS1M1 | |
Microsoft Windows XP Professional | 9.3 TS1M1 | |
Windows 7 Enterprise 32 bit | 9.3 TS1M1 | |
Windows 7 Enterprise x64 | 9.3 TS1M1 | |
Windows 7 Home Premium 32 bit | 9.3 TS1M1 | |
Windows 7 Home Premium x64 | 9.3 TS1M1 | |
Windows 7 Professional 32 bit | 9.3 TS1M1 | |
Windows 7 Professional x64 | 9.3 TS1M1 | |
Windows 7 Ultimate 32 bit | 9.3 TS1M1 | |
Windows 7 Ultimate x64 | 9.3 TS1M1 | |
Windows Vista | 9.3 TS1M1 | |
Windows Vista for x64 | 9.3 TS1M1 | |
64-bit Enabled AIX | 9.3 TS1M1 | |
64-bit Enabled HP-UX | 9.3 TS1M1 | |
64-bit Enabled Solaris | 9.3 TS1M1 | |
HP-UX IPF | 9.3 TS1M1 | |
Linux | 9.3 TS1M1 | |
Linux for x64 | 9.3 TS1M1 | |
Linux on Itanium | 9.3 TS1M1 | |
Solaris for x64 | 9.3 TS1M1 | |