Press "Enter" to skip to content

Category: Visualization

Using Multiple Scales with ggplot2 and ggnewscale

Zhenguo Zhang resets the scale:

In one ggplot figure, normally you can only use one scale for each aesthetic mapping. For example, if you use scale_color_manual() to set the color scale for a layer, you cannot use another scale_color_manual() for another layer, or set the color scale more then once in the function aes(). However, you can use the new_scale_color() function from the ggnewscale package to add a new scale for the same aesthetic mapping in different layers.

In this post, I will showcase how to use the new_scale_color() function to add two different color scales in a ggplot figure. The first scale will be for a discrete variable (e.g., number of cylinders), and the second scale will be for a continuous variable (e.g., density level).

Click through for the code and a demonstration.

Leave a Comment

Rounded Corners in Power BI

Elena Drakulevska breaks out the sandpaper:

I’ve been seeing all kinds of shapes in Power BI reports lately—and seems like there’s a lot of guesswork when it comes to rounded corners. Some people just throw in a number because it “feels modern”, others skip it altogether. But rounding shouldn’t be random.

Wondering what to do with your edges? Putting in a radius just because? Or maybe your designs still feel… too pointy?

Click through for some thoughts on rounding corners in Power BI, as well as how to do it.

Leave a Comment

Adding Carousel Buttons in Power BI

Boniface Muchendu builds a carousel:

Power BI carousel buttons allow users to cycle through visuals, measures, or text within a single report space—making your dashboards more interactive and space-efficient. While Power BI doesn’t include a native carousel visual, this guide shows how to simulate the same functionality using button slicers and field parameters. We’ll walk through several practical use cases, including switching between KPIs, toggling dimensions, and displaying text content, all with built-in Power BI features.

Click through to see how they work. I’m not a big fan of doing this on a proper dashboard, given that any visuals you’ve hidden on the carousel are no longer glanceable, but it’s a neat aesthetic idea for highly interactive reports.

Leave a Comment

Creating Error Bars in ggplot2

Zhenguo Zhang draws a chart:

Sometimes you may want to create a plot with the following features:

  • a point to indicate the mean of a group
  • error bars to indicate the standard deviation of the group
  • and each group may have subgroups, which are represented by different colors.

In this post, I will show you how to create such a plot using the ggplot2 package in R.

Read on for the demonstration, as well as fixing a common problem of overlapping data points. H/T R-Bloggers.

Leave a Comment

Graphs are Not Always Necessary

Alex Velez drives home a point:

Our current #SWDchallenge has been on my mind. For those who don’t know, we pose a different monthly suggestion for community members to build their data visualization and presentation skills. It could be a prompt to try a novel graph type, redesign an existing example, or practice a specific technique like chart animation. This month, data storyteller Simon asked us to consider whether data always needs to be communicated in a graph. Simon shares, “When you have just a number or two, writing the numbers themselves can be much more powerful than burying them in a table or graph and potentially losing the impact of the main number you’re looking to share.”

This statement came to mind when I reviewed a chart over the weekend. The chart I’m referring to is a bar graph displaying the weekly weight measurements of my dog, Nemo.

Click through for Alex’s argument. My take on the matter is that the point of visualization is to convey relevant information to your audience. If you can do that with a single word or a single number, you don’t need to go further.

Leave a Comment

Creating a Dashboard in Snowflake

Kevin Wilkie doesn’t just do e-mails:

If you haven’t had a chance to mess around in Snowflake, there are internal dashboards that you can provide to your users (or just use yourself) so that you can get the latest data.

Today, I want to quickly show a use case for these Dashboards and one way that you can get data quickly and easily in a nice format.

And right above Dashboards is Streamlit, one of my favorite libraries for building rapid application prototypes and even small data applications.

Comments closed

choroplethr 4.0.0 Now in CRAN

Ari Lamstein has an announcement:

With this version, I have transferred the maintenance of choroplethr to Zhaochen He, an economics professor at Christopher Newport University. Zhao addressed the issues that led to choroplethr being archived from CRAN in February. Please join me in thanking Zhao for his contribution!

Click through for the updates, as well as what Ari views as the current challenges for the project as he hands the project over Zhaochen He. H/T R-Bloggers.

Comments closed

Reactable Tables with Sparklines in Shiny Apps

Osheen MacOscar continues a series:

This is the third blog in a series about the {sparkline} R package for inline data visualisations. You can read the first one about getting started with the package here and the second one about embedding them in HTML tables with the {reactable} package here.

In this blog I am taking it a step further and demonstrating how to use our sparkline reactable table in a Shiny app. Thankfully {reactable} has some helpful functions that make this super easy! I will also look at using a dynamic traffic light image in a reactable table at the end.

Click through to see how it all works.

Comments closed

Thoughts on Dark Mode Reports in Power BI

Elena Drakulevska reminds us to think of the user:

Lately, there’s been a lot of hype around dark-mode reports—especially now that dark mode is officially a thing in Power BI. It’s sleek, it’s trendy, and, let’s be honest, it looks pretty cool.

But before we all jump on the dark-mode train, let’s pause for a second. Because, like most things in design, IT DEPENDS.

Click through for a primer on accessibility. Meanwhile, my hottest design take is that dark mode is wildly overrated. Invest in proper task lighting.

Comments closed

Building a Top N Analysis in Power BI

Hamza Boubou builds a dynamic report:

There was a requirement from my client that seemed simple at first but turned out to be a Trojan horse after deeper investigation. The goal was to create a Power BI Time Comparisons Top N Analysis page, giving users complete control over the Top/Bottom N products based on multiple metrics. Users needed to define the period, compare it with other periods, and adjust the N parameter dynamically.

Read on to see how Hamza was able to solve this customer request.

Comments closed