SVG定义继承

时间:2018-07-04 10:15:05

标签: svg

请查看# Sample data: df<-structure(list(ID=c(1:10), lat = c(1.4, 5.8, 4, 6.5, 5.1, 9.3, 8.6, 8.9, 4.4, 1.8) , lon = c(8.1, 4.8, 7.4, 4.8, 0.4, 5, 6.2, 1, 5, 5.2)) , .Names = c("ID","lat", "lon"), row.names = c(NA, -10L), class = c("data.table","data.frame")) ref<-structure(list(ID=letters[1:10], lat = c(1:10), lon = c(1:10)) , .Names = c("ID","lat", "lon"), row.names = c(NA, -10L), class = c("data.table","data.frame")) #Setting to data.table format setDT(df) setDT(ref) #creating a table with cartesian join df1<-setkey(df[,c(k=1,.SD)],k)[ref[,c(k=1,.SD)],allow.cartesian=TRUE][,k:=NULL] #calculating the Euclidean distance and giving a rank in ascending order of distance df1[,EuDist:=sqrt((lat-i.lat)^2+(lon-i.lon)^2)][,distRank:=rank(EuDist,ties="random"),by=.(ID)] #selecting the shortest distance df1<-df1[distRank==1] 。我想定义一个eaExperiment定义并将其旋转180度。

StartArrow

我肯定做错了,但是正确的方法是什么?

1 个答案:

答案 0 :(得分:0)

您需要单独的<marker>元素,但是它们的内容可以与<use>元素一起重用。例如这样的

<defs>
  <path id="arrow" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;fill:#000000;fill-opacity:1" d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " />
  <marker orient="auto" refY="0.0" refX="0.0" id="StartArrow" style="overflow:visible;">
    <use xlink:href="#arrow" />
  </marker>
  <marker orient="auto" refY="0.0" refX="0.0" id="EndArrow" style="overflow:visible;">
    <use xlink:href="#arrow" transform="rotate(180)" />
  </marker>
</defs>

(虽然已弃用xlink的{​​{1}}命名空间,并且从当前浏览器中不再需要的实际角度来看,我还是倾向于将其用于其他目的渲染器,例如Inkscape。)