I want to use plotly for interactive user-defined shapes.
I am aware this steps away from the graphics even though it remains in data-visualisation.
In my past work, I had used an xml file with the user defined shape, and had changed its color with the following code (attention, this is unfortunately not a self-contained example):
library(graphics)
library(grImport)
library(XML)
library(gridExtra)
library(jpeg)
library(png)
library(XML)
doc <- xmlParse("shape.eps.xml")
myDraw <- readPicture(saveXML(doc))
node <- xpathSApply(doc, paste("//path[@id='", myDraw, "']/context/rgb", sep = ""))[[1]]
rgbCol <- col2rgb(color)
xmlAttrs(node)["r"] = rgbCol[1]/255
For now I will go with the superposition of rectangles, but as along as my shape can defined split in rectangles. Is there then a way to import and color user-defined shapes with plotly?