Black Lives Matter. Please consider donating to Black Girls Code today.

R: Wrong marker size in scatterplot

Hello. I am trying to plot a scatterplot from a table and I am having a hard time setting up color and size of markers according to two variables in my table.

The code is (data object attached):

readRDS('testData.RDs')
p <- plot_ly(data = testData, type = 'scatter', x = ~x, y = ~y, 
         color = ~concordant, 
         text = ~pSize, 
         # size = ~markSize,
         marker = list(size=~pSize),
         mode='markers'
)
p

This particular combination sets colors correctly, but the sizes are NOT correct.
The variable markSize is basically a numeric coding for ‘concordant’, so whatever is concordant should be bigger and of different color.

If I use them independently everything works.

In addition, if I use size = ~pSize instead of the marker list, I get huge points without any control on their size.

I tried a million combinations, and I don’t know what else to try…