Difficultly when setting marker size using frame

I’m struggling to get my marker size to work as expected when I’m using it in an animated graph. Using a data set like below, I’d want the marker in column 1 to increase in size, then decrease; the marker in 2 to decrease in size, then increase; etc.:

data <- data.frame(xaxis = rep(as.character(c(1:5)), each = 10), 
                   yaxis = rep(c(1:5,5:1), 5), 
                   size = c(
                       rep(c(1,10), 5)
                    frame = c(1:10)

Frustratingly, when I run just one marker (i.e. data is data[data$xaxis == 1, ] ), everything works as expected; but by the time show all 5 markers, the sizes go haywire.

How can I get better control of my marker size?

Example plot:

    data = data,
    x = ~xaxis,
    y = ~yaxis,
    frame = ~frame,
    type = 'scatter',
    marker = list(size = ~size*10),
    mode = 'markers'
1 Like

This was helpfully solved by someone on stack overflow, seems to be an issue with the way the data.frame is sorted. I’ll do a little more investigation then raise an issue - link in case anyone wants to check: