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!
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.
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.
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:
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.