我正在使用xyplot创建使用grImport包导入的自定义符号的绘图。要在xyplot中使用符号,我将遵循grImport文档中的示例:
panel = function(x, y, ...){grid.symbols(customSymbol, x, y, units = "native",size = unit(15, "mm"))}
我想将groups参数用于不同颜色的自定义符号(例如redSymbol,blueSymbol,purpleSymbol)。看完之后看起来我会使用panel.superpose但是我不确定如何用grid.symbols做到这一点?
我知道如何使用不同的grid.symbols向xyplot添加新图层,但我想开始使用组。谢谢!
编辑:以下是文档
中的修改示例#Create custom symbol
library(grImport)
PostScriptTrace("flower.ps") #Start with any SVG file and convert to .ps
blackFlower <- readPicture("flower.ps.xml")
#Create red flower
blackFlowerRGML <- xmlParse("flower.ps.xml")
xpathApply(blackFlowerRGML, "//path//rgb", 'xmlAttrs<-',value = c(r = 1, g = 0, b = 0))
saveXML(blackFlowerRGML, "redFlower.ps.xml")
redFlower <- readPicture("redFlower.ps.xml")
#Scatter plot with two groups (black and red flowers)
library("cluster")
xyplot(V8 ~ V7,data = flower, groups=V1,par.settings=list(superpose.symbol=list(grid.symbols(blackFlower),grid.symbols(redFlower))))