Redash: Bubble size should scale area, not radius

Created on 28 Nov 2019  路  8Comments  路  Source: getredash/redash

Issue Summary

The size of bubbles seems to be applied directly as the diameter of the bubble. This means that doubling the size makes the bubble area quadruple, which is visually misleading if you are plotting a quantity, which I expect is the common case.

Steps to Reproduce

Select some data with a simple query like SELECT 1, 2, 50 UNION ALL SELECT 3, 4, 100, and plot it as a bubble chart. The bubble with size 100 will be four times the size of the bubble with size 50.

I would expect the radius to be set as the square root of the size, which would make the area and perceived size scale linearly with size. For example, this is how matplotlib does it.

Technical details:

  • Redash Version: 8.0.0-beta+b27489
  • Browser/OS:
  • How did you install Redash: Helm chart
Frontend Visualizations

Most helpful comment

This looks like a pretty simple change. Plotly supports the sizemode attribute for Bubble charts. The options are diameter and area.

Plotly doc: https://plot.ly/python/reference/#scatter-marker-sizemode

I changed it on a local build...

Diameter

diameter

Area

area

All 8 comments

This looks like a pretty simple change. Plotly supports the sizemode attribute for Bubble charts. The options are diameter and area.

Plotly doc: https://plot.ly/python/reference/#scatter-marker-sizemode

I changed it on a local build...

Diameter

diameter

Area

area

Hi @susodapop, thanks for testing out and finding a way to handle this.

Is the difference between the two screenshots sizemode value only? For me, in some cases changing this value drastically shrunk the size of the circles. Yours look okay, and need no other measures to "look normal".

@deecay Thanks for mentioning that. I did change my query.

diameter accepts bubble size values from 1 - 100 and applies a floor and a ceiling so that values outside these thresholds are normalized back to the edges (105 -> 100. -5 -> 0). The diameter sizemode is effectively a _percentage of a derived max bubble size_ which Plotly calculates dynamically based on the x and y size of the chart.

area is an absolute pixel value: _the number of pixels that should appear in this bubble_. There is no ceiling on this value. So a bubble size of 40 under the diameter sizemode might have an area 350 pixels. Switching to area will of course shrink the bubble.

I changed my query to multiple my calculated values by 1000 instead of 100.

@susodapop, thanks again for the investigation.

So we need three things.

  1. Bubble size to sizemode.
  2. Let the user define coefficient as in #3928.
  3. Think about if we need some kind of migration for the existing bubble charts, for the look will drastically change. However, I don't believe we can come up with a robust equation to determine decent default coefficients for all existing Bubble charts. Any thoughts anybody?

Migration shouldn't be an issue. We can default the bubble chart to use diameter, the same as today.

I believe the default should be area, because most of the time area is what we want?

@deecay It could be default for new charts, but migration should keep old behavior for all existing ones.

I've updated my PR #3928 with 'diameter' as a default for sizemode. This does not require migration, so if this is acceptable, I would like to go with this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

koooge picture koooge  路  3Comments

yalisassoon picture yalisassoon  路  4Comments

stephane-klein picture stephane-klein  路  3Comments

tomaytotomato picture tomaytotomato  路  4Comments

arikfr picture arikfr  路  3Comments