Published and tested 18 November 2026.
What does the corrected figure look like?
The gray side panel shows No answer at 4%, 6% and 2% for Access, Cost and Timing. Both figures use the same synthetic counts: 100 responses per question, including No answer. Only the layout and labeling change. This article uses simulated example data.
On small screens, scroll the figure horizontally or open the full-size image.


Which complete R script produces these figures?
Install ggplot2, ggstats, patchwork and labelled from CRAN if needed. labelled is needed by this ggstats call even though it is listed as a suggested package. Run the script in a writable working directory; it creates likert-output. Tested on R 4.5.3 with ggstats 0.14.0, ggplot2 4.0.4, patchwork 1.3.2, labelled 2.16.1 and scales 1.4.0.
install.packages(c("ggplot2", "ggstats", "patchwork", "labelled"))# Bopbun original example. Code: CC0-1.0.
# Tested: R 4.5.3, ggstats 0.14.0, ggplot2 4.0.4, patchwork 1.3.2.
library(ggplot2)
library(ggstats)
library(patchwork)
answers <- c("Strongly disagree", "Disagree", "Neutral",
"Agree", "Strongly agree", "No answer")
counts <- list(
Access = c(10, 15, 20, 25, 26, 4),
Cost = c(8, 15, 24, 30, 17, 6),
Timing = c(20, 18, 20, 20, 20, 2)
)
survey <- as.data.frame(lapply(counts, function(n) {
factor(rep(answers, times = n), levels = answers)
}))
# Every question has 100 responses, including the side category.
stopifnot(all(vapply(counts, sum, numeric(1)) == 100))
side_share <- vapply(survey, function(x) mean(x == "No answer"), numeric(1))
stopifnot(max(side_share) < 0.2)
p <- gglikert_side(
survey, side_values = "No answer", add_totals = FALSE,
labels_hide_below = 0.07, labels_size = 3, labels_accuracy = 1
) & theme_minimal(base_size = 10)
p[[1]] <- p[[1]] + theme(legend.position = "bottom") +
guides(fill = guide_legend(nrow = 2))
p[[2]] <- p[[2]] + labs(title = "No answer") + theme(axis.text.y = element_blank(),
axis.ticks.y = element_blank(), legend.position = "none")
before <- p + plot_annotation(
title = "Synthetic survey: default side axis",
caption = "100 responses per question; No answer is included in the denominator."
)
# In ggstats 0.14.0, component 2 is the side plot.
# Give the 2-6% side values room, and use just three tick positions.
fixed <- p
fixed[[1]] <- fixed[[1]] + coord_cartesian()
fixed[[2]] <- fixed[[2]] + scale_x_continuous(
limits = c(0, 0.2), breaks = c(0, 0.1, 0.2),
labels = scales::label_percent(accuracy = 1),
expand = expansion(mult = c(0, 0.05))
) + coord_cartesian() + geom_text(
data = data.frame(question = names(side_share), share = unname(side_share)),
aes(x = share, y = question, label = scales::percent(share, accuracy = 1)),
inherit.aes = FALSE, hjust = -0.3, size = 3, colour = "black"
)
fixed <- fixed + plot_layout(widths = c(4, 1))
after <- fixed + plot_annotation(
title = "Synthetic survey: explicit side axis and panel widths",
caption = "100 responses per question; No answer is included in the denominator."
)
dir.create("likert-output", showWarnings = FALSE)
for (name in c("before", "after")) {
ggsave(file.path("likert-output", paste0(name, ".png")),
plot = get(name), width = 180, height = 100, units = "mm",
dpi = 300, device = "png", bg = "white")
}
ggsave("likert-output/after.pdf", plot = after,
width = 180, height = 100, units = "mm", device = "pdf")
write.csv(data.frame(Response = answers, counts),
"likert-output/counts.csv", row.names = FALSE)
print(side_share)
sessionInfo()Download the complete example: R script · Corrected PNG · Corrected PDF · Synthetic counts CSV.
Why do axis limits and panel widths need separate changes?
In the tested ggstats release, gglikert_side() returns a patchwork with fixed coordinates in both component plots. A small side proportion gives the right panel a small x range. Changing width in gglikert_side() changes bar thickness. I remove the fixed aspect ratio, set the side scale, then allocate panel widths 4:1. This ratio sets the widths of the plotting regions.
Component 2 is the side plot in ggstats 0.14.0; inspect the object after a package upgrade. The 20% upper bound is specific to these data. Check your largest side proportion before choosing limits: scale limits can remove out-of-range data. With multiple side categories, check their combined proportion. The stopifnot check deliberately stops this single-category example if the chosen range is too small.
Which numbers and export properties were checked?
Access has 4/100 No answer responses, Cost 6/100 and Timing 2/100. The other five counts plus No answer total 100 for each item. No answer remains in the denominator after moving to the side panel; recoding it to NA would change the denominator.
| Synthetic item | No answer | All responses | Side proportion |
|---|---|---|---|
| Access | 4 | 100 | 4% |
| Cost | 6 | 100 | 6% |
| Timing | 2 | 100 | 2% |
The script exports each PNG at 180 × 100 mm and 300 DPI. The actual files are 2,125 × 1,181 pixels, reflecting integer pixel conversion; their stored resolution is approximately 300 PPI. The requested PDF size is 180 × 100 mm; its actual MediaBox is 510 × 283 points (179.92 × 99.84 mm). Adjust label positions and panel widths in the layout settings.
Where can I verify the behavior and reuse the example?
The question was prompted by a public Reddit discussion dated 17 November 2026. This tutorial uses original example data to reproduce the layout problem. Package behavior was checked against the official references and the installed function.
- ggstats: gglikert_side()
- patchwork: plot_layout()
- ggplot2: coord_cartesian()
- ggplot2: scale_x_continuous()
- ggplot2: ggsave()
- Reddit: 2026-11-17
The example code and synthetic counts are released under CC0-1.0; you may adapt them commercially. Our generated PNG/PDF figures may also be reused under CC0-1.0. R packages retain their own licenses: ggstats and labelled GPL ≥ 3, ggplot2 and patchwork MIT. No package code, forum image or respondent data is bundled in the downloads.
For general two-panel export, see the ggplot2 export tutorial. For pixel calculations, use the figure size calculator.
Learn R

