BookmarkSubscribeRSS Feed

How Upgrade Your VA Bubble Plots With Data Labels

Started ‎06-16-2020 by
Modified ‎06-16-2020 by
Views 2,000

I'm always looking for ways to make my Visual Analytics reports better. Sometimes, just a small change can greatly improve a report's usefulness and readability.


For example, if you have a standard bubble plot with several bubbles on it, continually referencing the graph's legend colors in coordination with the bubbles colors can be challenging. Take a look at the bubble chart below which plots the values of the sashelp.class data set. Each bubble represents an individual student. Does the orange bubble in the top right represent Alice or Phillip? 



Difficult to tell, isn't it? Wouldn't it be easier if we could place each student's name label next to their associated bubble? Well guess what? Using the graph builder, you can! By making just a few small changes to the standard bubble plot, I was able to create this version of the graph:



The addition of the labels to the bubbles allows the user to easily see that the bubble in the top right represents Philip. Just this little change really improved the functionality of this report. In this post, I'll show you how to create a custom bubble plot graph that adds labels to your bubbles!


Step 1: Build the graph


Start by creating a new custom graph using the SAS® Graph Builder. Drag a Bubble Plot object onto the canvas:




With the bubble plot selected, from the right pane select the "Roles" menu. Click "Add Role":




At the next screen, select "Data Label" and press OK:




Now, still from within the "Roles" menu click "Add Role" again:




At the next screen, select "Group" and press OK:




Finally, (still from within the roles menu) click the three dots next to the newly created role "Bubble Plot 1 Data Label" and select:

"Create Shared Role With Another Role" -> "Bubble Plot 1 Group"




For the Role Name input "Bubble Plot Group" and press "OK":




And you're done! You've successfully built the custom graph. Save your graph and give it a name.


Step 2: Create the Report


For the example report displayed at the top of this post, I used the sashelp.class data set. To replicate this example, begin by first loading the sashelp.class data set into CAS and then creating a new Visual Analytics report and adding the data set to your report.


Now, our report is ready for our custom graph! All that's left for us is to import the custom graph to the Visual Analytics report we're working on.  Drag the custom graph into the report's canvas and apply the data roles as shown:




And that's it! You've successfully upgraded your bubble plot by adding labels to the data points! 




For this article, I did filter some of the data points to make the labels on the bubble plot easier to see. This filter can be seen in the completed Visual Analytics report which is available in this article's GitHub.


How to make this example work for you

This example was created in SAS Visual Analytics 8.5. For this article's data, I used the 'class' data set which is in the sashelp library.


On Github, you will find the following support files for this article:

  • A JSON file containing the completed custom graph - bubblePlotWithLabels_CG.json
  • A JSON file containing the completed report - bubblePlotWithLabels.json

 Take Me to GitHub!



Version history
Last update:
‎06-16-2020 01:24 PM
Updated by:



Registration is open! SAS is returning 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. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Labels
Article Tags