Skip to main content
v2026.11,986 entries · CC-BY 4.0

Bubble Chart in R: ggplot2 geom_point() and base R symbols()

Build a bubble chart in R with ggplot2 and base R symbols(), choose between area and radius size scales, and read the output correctly.

Written and maintained by CASRAI Editorial Board

Published · Last updated

On this page

A bubble chart in R is a scatterplot in which a third numeric variable controls the size of each point. In ggplot2 you build one with geom_point() by mapping that variable to the size aesthetic, and you control how large the bubbles get with scale_size(); in base R you draw circles with symbols(). The part most tutorials skip is what “size” means: ggplot2’s size scales are documented to scale the area of the symbol, and that choice decides whether your chart is honest.

What a bubble chart is used for in research

A bubble chart (also called a bubble plot, and searched for as “bubble plot r”, “bubble chart r” or “r bubble chart”) shows three quantitative variables at once: position on the x axis, position on the y axis and bubble size. In research writing it is typically used for country- or group-level data, where each bubble is one unit and its size is a count or population, as in the well-known life expectancy against income charts built from the gapminder data. If you only need two variables, a plain scatterplot is the better choice; see our guide to scatterplots in R. If you need an introduction to the underlying plotting system, start with ggplots in R.

Because bubble size is read by eye, it is a coarse encoding. Readers can rank bubbles and spot extremes, but they cannot read exact values from them. Put exact values in a table or label the points that matter.

How to install or access it

R itself and the packages used here come from CRAN, the Comprehensive R Archive Network. ggplot2 is documented at ggplot2.tidyverse.org. Install the packages once, then load them in each session:

install.packages("ggplot2")
install.packages("gapminder")   # example data, see the gapminder README on CRAN

library(ggplot2)
library(gapminder)
library(dplyr)

Base R’s symbols() lives in the graphics package that ships with R, so it needs no installation. The first example below uses mpg, a data set that is built into ggplot2, so you can run it without installing anything else. For the background on the gapminder data, see our gapminder guide.

Step-by-step: make a bubble chart in R

Step 1. Draw a bubble chart with ggplot2 and geom_point()

The ggplot2 reference states the idea directly: map a variable to size inside aes() and add geom_point(). This uses the built-in mpg data, with city mileage (cty) as the bubble size:

ggplot(mpg, aes(x = displ, y = hwy, size = cty)) +
  geom_point(alpha = 0.5)

ggplot2 builds the size legend automatically. The alpha argument makes points semi-transparent so overlapping bubbles stay visible.

Step 2. Use real group-level data: the gapminder bubble plot

The classic bubble plot in R uses one row per country. The R Graph Gallery’s basic bubble plot builds it from the gapminder data for the year 2007, with GDP per capita on x, life expectancy on y and population as the size. Sort the rows so the largest bubbles are drawn first and cannot cover the small ones (the gallery does this with dplyr’s filter() and arrange(desc(pop)); the base R lines below do the same):

data = gapminder[gapminder$year == 2007, ]
data = data[order(-data$pop), ]

ggplot(data, aes(x = gdpPercap, y = lifeExp, size = pop)) +
  geom_point(alpha = 0.7) +
  scale_size(range = c(0.1, 24), name = "Population (M)")

Here order(-data$pop) sets the draw order, and scale_size(range = ...) sets the smallest and largest symbol size. The name argument relabels the legend. Note that the legend title in this example says millions; if your size variable is raw counts, either rescale it (for example pop / 1e6) or label the legend accordingly.

Step 3. Colour the bubbles by a category

To colour bubbles by group, use a filled point shape. The ggplot2 documentation for geom_point() states that the fill aesthetic only applies to shapes 21 to 25, where colour sets the border and fill the inside. So pair fill = continent with shape = 21:

ggplot(data, aes(x = gdpPercap, y = lifeExp, size = pop, fill = continent)) +
  geom_point(alpha = 0.5, shape = 21, color = "black") +
  scale_size(range = c(0.1, 24), name = "Population (M)")

If you map fill while using the default point shape, the colour will not appear, because the default shape has no fill. For styling the axes, legend and background, see theme in R.

Step 4. Choose the right size scale

This is the decision that separates a defensible bubble chart from a misleading one. The ggplot2 reference for the size scales says scale_size() scales the area, whereas scale_radius() scales the radius, and that because humans perceive the area of points rather than their radius, area scaling “provides for optimal perception”. The same page calls mapping size to radius “usually a bad idea”. The data table below lists the four size tools and what each one scales.

Two practical consequences follow. First, with scale_size() a value of zero does not necessarily get a symbol of size zero; the documentation recommends scale_size_area() when you want a zero value to have zero size. Second, if you would rather group values into steps than show a continuous scale, scale_size_binned() uses guide = "bins" to draw a binned legend.

ggplot(data, aes(gdpPercap, lifeExp, size = pop)) +
  geom_point(alpha = 0.6) +
  scale_size_area(max_size = 12, name = "Population")

Step 5. Draw a bubble plot in base R with symbols()

Base R has no dedicated bubble function, but symbols() draws circles at x and y positions. Its circles argument is documented as “a vector giving the radii of the circles”, which means that passing your raw values makes the radius, not the area, proportional to the value. To make the area proportional, pass the square root of the value (this follows from the area of a circle being proportional to the square of its radius):

symbols(data$gdpPercap, data$lifeExp,
        circles = sqrt(data$pop),
        inches = TRUE,
        bg = "grey80", fg = "black",
        xlab = "GDP per capita", ylab = "Life expectancy")

The inches argument controls symbol size: with TRUE, which is the default, the symbols are scaled so that the largest has a dimension of one inch; setting FALSE instead draws circles in axis units. The base R documentation also notes that circles of radius zero are plotted at a radius of one pixel, which is device-dependent, and that very small non-zero radii may or may not be visible.

Output and how to read it

In the ggplot2 versions, the position of each bubble gives its x and y values and the legend gives the size mapping. Read it in this order:

  1. Position first. Look for the trend or clusters in x and y, exactly as in a scatterplot.
  2. Then size as a ranking. Because size is mapped to area, a bubble that looks about twice as big in area represents roughly twice the value, but only if the scale starts from zero (see scale_size_area() above). With scale_size() and a custom range, the smallest value in your data gets the smallest symbol rather than a zero-size one, so relative sizes can overstate differences.
  3. Check the legend. Confirm the units and the breaks. A legend title that says “Population (M)” over an unscaled count is a common labelling error.
  4. Treat overlap with care. If bubbles cover each other, the draw order and transparency matter more than the size range.

In a manuscript, state in the caption which variable maps to bubble size and whether size encodes area. That one sentence prevents most misreadings.

Troubleshooting

Big bubbles hide small ones

Sort the data so large values are drawn first, as in Step 2, and add transparency with alpha. The geom_point documentation calls overplotting “the biggest potential problem with a scatterplot” and lists alpha (for example alpha = 0.05 for dense data), shape = ".", geom_count(), geom_hex() and geom_density2d() as options.

The colour does not show up

You mapped fill but are using a shape without a fill. Use shape = 21 (shapes 21 to 25 accept fill) and set colour for the border; stroke controls the border width.

Bubbles are too big or too small

Adjust the range argument of scale_size() or scale_radius() (a numeric vector of length 2 giving the minimum and maximum symbol size after transformation), or max_size in scale_size_area(), which sets the size of the largest points.

Some points are missing in base R

With symbols(), a zero or very small radius may be drawn at one pixel or not be visible, as noted above. Check for zeros and tiny values in the size variable.

The chart needs to be interactive

A static ggplot2 chart does not show values on hover. Our guide to plotly in R covers interactive charts.

Free alternatives

All of the tools below are free and open source R tools. The table is a decision aid for choosing among them, based on the ggplot2 and base R documentation cited in the sources.

Tool How size is set Use it when
ggplot2 geom_point() with size Map a variable to size; tune with scale_size() or scale_size_area() You want an automatic legend, fill by category and a theme you can reuse
Base R symbols() Pass radii to circles; control scale with inches You want circles with no extra packages
ggplot2 geom_count() Size reflects the number of overlapping observations (listed in the geom_point documentation as an overplotting remedy) Your points overlap heavily and no third variable exists
plotly for R See our plotly guide You need hover text and interaction

Worked example: choosing between scale_size() and scale_size_area()

Suppose a research team plots gapminder countries for 2007 and wants the legend to show that a country with twice the population has twice the bubble area. Using scale_size(range = c(0.1, 24)), the smallest population in the data is drawn at the minimum symbol size of 0.1, not at zero, so the bubble areas are scaled between the minimum and maximum symbol sizes rather than in strict proportion to the raw values. Using scale_size_area(max_size = 12) instead, the documentation says zero maps to zero size, which keeps area proportional to the value. The first option is fine for a quick exploratory view; the second is the safer choice for a publication figure where readers will compare bubbles by area.

Frequently asked questions

How do you make a bubble chart in R?

Use ggplot2: map your third variable to size inside aes(), add geom_point(), and tune the sizes with scale_size(). In base R, use symbols(x, y, circles = ...).

What is the difference between a bubble plot and a scatterplot in R?

A scatterplot shows two variables by position. A bubble plot is a scatterplot with a third variable encoded as symbol size. In ggplot2 both use geom_point(); the only difference is the size mapping.

Does bubble size in ggplot2 represent area or radius?

Area. The ggplot2 reference says scale_size() scales the area and scale_radius() scales the radius, and recommends area because people perceive the area of points.

How do I make a zero value show as no bubble?

Use scale_size_area(). The ggplot2 examples say to use it if you want a zero value to have zero size.

How do I colour bubbles by group?

Use shape = 21 with fill = group. The fill aesthetic applies only to shapes 21 to 25.

How do I make a bubble plot in base R?

Call symbols() with the x values, the y values and a circles vector of radii. Pass sqrt(value) if you want area proportional to the value.

Sources

Data: R bubble-size tools: what each scales and its documented size argument

Compares the ggplot2 size scales and base R symbols() by what quantity they map a value to, the argument that sets symbol size, and the default shown in the documented function signature. Compiled from the ggplot2 and R reference pages.

R bubble-size tools: what each scales and its documented size argument
FunctionMaps the value toSize argumentDocumented default
scale_size()Symbol arearangeNULL
scale_radius()Symbol radiusrangec(1, 6)
scale_size_area()Symbol area, zero value gives zero sizemax_size6
symbols(circles = )Circle radiusinchesTRUE (largest symbol one inch)

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about Bubble Chart in R: ggplot2 geom_point() and base R symbols()

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →