# R: Wrong marker size in scatterplot

**URL:** <https://community.plotly.com/t/r-wrong-marker-size-in-scatterplot/10745>\
**Category:** Plotly R\
**Created:** [June 6, 2018, 7:51pm UTC](https://community.plotly.com/t/r-wrong-marker-size-in-scatterplot/10745 "2018-06-06T19:51:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdonato](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@mdonato](https://community.plotly.com/u/mdonato)\
**Post date:** [June 6, 2018, 7:51pm UTC](https://community.plotly.com/t/r-wrong-marker-size-in-scatterplot/10745/1 "2018-06-06T19:51:17Z")

</div>

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…
