Bubble plot still ignores size constraints for singleton color categories
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
As you can see in the following reprex, the sizing options get ignored for the singleton category (color == "D"); commit https://github.com/plotly/plotly.R/commit/306b4ef057631f9d3200fdfce636696bc0268952 seemed intended to fix this issue but it persists.
library(plotly)
library(dplyr)
dat = structure(list(color = c("A", "A", "A", "B", "B", "C", "C", "D"
), size = c(2L, 1L, 1L, 803L, 254L, 339L, 261L, 577L), x = c(0,
0, 0, 32.9, 52, 20.4, 33.3, 73.7), y = c(0, 0, 0, 0.7, 0.8, 0.6,
0, 0.2)), row.names = c(NA, -8L), class = c("tbl_df", "tbl",
"data.frame"))
print(dat)
desired_maximum_marker_size = 10
sizeref <- 2 * max(dat$size) / (desired_maximum_marker_size^2)
plotly::plot_ly(
data = dat,
y = ~y,
x = ~x,
color = ~color,
type = "scatter",
mode = 'markers',
sizes = c(1, desired_maximum_marker_size),
marker = list(
size = ~size,
sizemin = 1,
sizemax = 10,
opacity = 0.7,
sizeref = sizeref,
sizemode = 'area')
)

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the supplied R reprex with plotly and confirm that the singleton color category ignores the marker sizing constraints. Trace how marker sizes are handled when a color category has one observation, then add a regression test covering that case. Done means the singleton category respects sizemin, sizemax, sizeref, and sizemode consistently with the other categories.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100