# How do I accomplish a bubble diagram

**URL:** <https://discourse.julialang.org/t/how-do-i-accomplish-a-bubble-diagram/23416>\
**Category:** New to Julia\
**Created:** [April 22, 2019, 6:41pm UTC](https://discourse.julialang.org/t/how-do-i-accomplish-a-bubble-diagram/23416 "2019-04-22T18:41:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![phil1](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@phil1](https://discourse.julialang.org/u/phil1)\
**Post date:** [April 22, 2019, 6:41pm UTC](https://discourse.julialang.org/t/how-do-i-accomplish-a-bubble-diagram/23416/1 "2019-04-22T18:41:43Z")

</div>

I would like to plot a bubble diagram, where each data point has three numbers; x,y and a size (the radius of the bubbles).

Despite extensive search on the Internet I have not come across any example in julia.

Thanks

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [April 22, 2019, 6:54pm UTC](https://discourse.julialang.org/t/how-do-i-accomplish-a-bubble-diagram/23416/2 "2019-04-22T18:54:26Z")

</div>

scatter plot? [Various Julia plotting examples using PyPlot · GitHub](https://gist.github.com/gizmaa/7214002#scatterplot)

---

<div class="post-metadata">

**Author:** ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)\
**Post date:** [April 22, 2019, 8:46pm UTC](https://discourse.julialang.org/t/how-do-i-accomplish-a-bubble-diagram/23416/3 "2019-04-22T20:46:58Z")

</div>

For Gadfly, use the `size` aesthetic:

```julia
coord = Coord.cartesian(xmin=0, xmax=1, ymin=0, ymax=1)
p = plot(x=rand(100), y=rand(100), size=rand(1:8, 100)./150, Geom.point, coord)

```

Note the status of a [sizekey](http://gadflyjl.org/dev/tutorial/#Continuous-Scales-1) is to be done.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 22, 2019, 11:59pm UTC](https://discourse.julialang.org/t/how-do-i-accomplish-a-bubble-diagram/23416/4 "2019-04-22T23:59:47Z")

</div>

You can use [`scatter` in PyPlot](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.scatter.html#matplotlib.pyplot.scatter): `scatter(x,y, s=radii)`

---

<div class="post-metadata">

**Author:** ![phil1](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@phil1](https://discourse.julialang.org/u/phil1)\
**Post date:** [April 23, 2019, 5:49pm UTC](https://discourse.julialang.org/t/how-do-i-accomplish-a-bubble-diagram/23416/5 "2019-04-23T17:49:36Z")

</div>

Thank you! Scatterplot that was what I was looking for.
