I want to plot some data using beeswarm in R, where the bg color of each point is defined by a column in my data. For example:
head(mydata)
## id provean color
## 1635 9.428 #fee5d9
## 1092 9.000 #fb6a4a
## 791 8.708 #ffffff
## 1472 7.596 #fcae91
## 228 7.552 #ffffff
## 1004 7.433 #fcae91
The color column has the hex color codes I would like each point to have, and I try to implement it like this:
colorByMML <- mydata$color
beeswarm(mydata$provean,pch=21,cex=0.7, bty="n", col="#708090",pwbg=colorByMML)
But I get different colors than the expected ones.
If instead of the hex codes I give integers, I get other colors. For instance if instead of the hex code of white(#ffffff) I input '1', I get black as the bg color. In short, how do I customize the color of each point?