Skip to content

docs: Update packed bubble example#3955

Merged
domoritz merged 4 commits intovega:mainfrom
PBI-David:docs-update-packed-bubble-example
Aug 2, 2024
Merged

docs: Update packed bubble example#3955
domoritz merged 4 commits intovega:mainfrom
PBI-David:docs-update-packed-bubble-example

Conversation

@PBI-David
Copy link
Contributor

Update the packed bubble chart to use a square root scale so as not to be misrepresentative.

Added square root scale for this to be more accurate. Default of linear scale is misrepresentative
@PBI-David PBI-David requested a review from a team as a code owner August 2, 2024 10:03
@domoritz
Copy link
Member

domoritz commented Aug 2, 2024

Unfortunately neither a sqrt nor a linear scale is really representative. People don't interpret size by either.

@PBI-David
Copy link
Contributor Author

PBI-David commented Aug 2, 2024

Every dataviz tool that has a bubble plot that I'm aware of use a square root scale otherwise the proportions are way off (a value twice as large should not be represented by a circle with twice the diameter). I don't mind either way but thought this would be more aligned with what I see elsewhere.

@kanitw
Copy link
Member

kanitw commented Aug 2, 2024

(a value twice as large should not be represented by a circle with twice the diameter)

FYI, Vega size channel maps data to area, not diameter/radius.

@PBI-David
Copy link
Contributor Author

PBI-David commented Aug 2, 2024

@kanitw - I'm sure you're already aware but the size channel can be a bit confusing in the way it is calculated, especially with respect to circles (see here: #2730). I can withdraw the PR if you like but using a square root scale would mean it is more aligned with how circles are represented in other dataviz tools.

PS I did create the original example.

@PBI-David
Copy link
Contributor Author

Alternatively, I could add a signal that allows a user to switch between the scales which could help illustrate the choice people need to make.

@PBI-David
Copy link
Contributor Author

Here is a screenshot to illustrate the issue. The smaller circle has a value of 1 and the larger circle has a value of 2.

Using a linear scale ends up with this (radius is doubled):

image

image

Using a squareroot scale ends up with area being doubled:

image

image

@domoritz
Copy link
Member

domoritz commented Aug 2, 2024

@PBI-David
Copy link
Contributor Author

@domoritz possibly. Although if I simplify to just the field value, I can't get the areas or diameters to make sense using linear or sqrt scales. I'm probably missing something obvious though. What do you think it should be changed to? Keeping it as proposed but changing just the scale allows:

linear = double diameter
sqrt = double area

@domoritz
Copy link
Member

domoritz commented Aug 2, 2024

How about Open the Chart in the Vega Editor

@PBI-David
Copy link
Contributor Author

@domoritz looks good to me - I have updated it. The areas are slightly off but this is probably down to my screen ruler rounding to integers.

@domoritz
Copy link
Member

domoritz commented Aug 2, 2024

Thanks!

@domoritz domoritz merged commit bd21346 into vega:main Aug 2, 2024
@PBI-David PBI-David deleted the docs-update-packed-bubble-example branch August 2, 2024 19:40
@kanitw
Copy link
Member

kanitw commented Aug 2, 2024

PS I did create the original example.

Gotcha. Thanks for contributing!

@PBI-David
Copy link
Contributor Author

PS I did create the original example.

Gotcha. Thanks for contributing!

Thanks for creating such a versatile and powerful dataviz library 😉

BTW, I have a lot advanced examples on my GitHub that I can create PRs for if you think they might be useful. The sankey and gantt charts have been very popular.

@domoritz
Copy link
Member

domoritz commented Aug 3, 2024

That's awesome. I wonder how we can maybe make it easier to have community examples that don't have to be part of this repo. We could do something similar to Vega-Lites listing but maybe with screenshots to make it easy to go to them.

Thoughts?

@PBI-David
Copy link
Contributor Author

That makes sense to me. It would be easier to maintain and contribute as I see great Vega examples all the time that most are unaware of. FYI, Vega/VL have become very popular in the Power BI space via a container called Deneb. There is growing demand from that user base for a grammar of graphics approach to dataviz. I know the gantt chart is used extensively at some very high profile companies and organisations.

Gantt

@domoritz
Copy link
Member

domoritz commented Aug 3, 2024

That's super cool. I've previously thought about ways to let people add examples to an index in the Vega editor but it became too much work to develop/maintain. A community example section here similar to https://vega.github.io/vega-lite/examples/#community-examples but with images (as suggested in vega/vega-lite#3120) would be pretty awesome. Would you like to take a stab at it? We could copy the approach in Vega-Lite as well.

@PBI-David
Copy link
Contributor Author

Happy to have a go but I don't have an environment so everything would need to be done via the web. If it is just a new header and a list of links, then I can submit a PR for that.

@domoritz
Copy link
Member

domoritz commented Aug 3, 2024

We can start with a list just like Vega-Lite.

@PBI-David
Copy link
Contributor Author

Hmm - just taken a look and I'm not even sure I can do this simple change without a working environment to test. VL and Vega documentation use different systems so I can't just copy it across and hope for the best. I believe this is the correct page:

https://github.com/PBI-David/vega/blob/main/docs/_layouts/example.html

Can I just add raw HTML as a bulleted list and heading? Will it be styled correctly?

Even though it is a simple addition, this probably needs to be done by someone who can preview how the changes will appear. Once the skeleton is in place, I can add a few examples I have seen on the web.

In parallel, I'll try and get a local environment running again but I hit too many blockers on Windows last time and just gave up.

@domoritz
Copy link
Member

domoritz commented Aug 5, 2024

The setup probably works in the subsystem for Linux.

@hydrosquall
Copy link
Member

hydrosquall commented Aug 6, 2024 via email

@PBI-David
Copy link
Contributor Author

Thanks @hydrosquall . I was thinking something very simple like the following to mirror VL. We could list individual examples or the whole site as a link. e.g.

Community Examples

Here is a list of great examples of Vega visualizations that were created by the community.

majornista pushed a commit to majornista/vega that referenced this pull request Aug 14, 2024
Update the packed bubble chart to use a square root scale so as not to
be misrepresentative.
@lsh lsh mentioned this pull request Jan 24, 2025
lsh added a commit that referenced this pull request Jan 24, 2025
changes since v5.30.0

**vega-utils**
* use `Object.hasOwn` instead of `Object.prototype.hasOwnProperty` (via
#3951). (Thanks @domoritz!)

**vega-parser**
* Add discrete legend type (via #3957). (Thanks @hydrosquall!)

**vega-functions**
* Add sort function to vega-functions (and vega-interpreter) (via
#3973). (Thanks @hydrosquall!)

**vega-selections**
* Add field predicate types to selectionTest (via #3675). (Thanks
@jonathanzong!)

**monorepo**
* Replace flights-5k.json external reference (via #3999). (Thanks
@dwootton!)

**docs**
* Update packed bubble example (via #3955). (Thanks @PBI-David!)
* Correct typo in production rules documentation (via #3958). (Thanks
@shanebruggeman!)
* Update README.md to fix broken link to current roadmap (via #3979).
(Thanks @cahogan & @joelostblom!)

---------

Signed-off-by: Lukas Hermann <1734032+lsh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants