@@ -29,40 +29,44 @@ circleplot<-function(
29
29
scale.distance <- as.matrix(scale.distance )
30
30
31
31
# set plot window attributes
32
- if (add == FALSE ){
33
- do.call(par , circleplot.object $ par )
34
- do.call(plot , circleplot.object $ plot )}
35
32
if (class(input )== " list" )par(mfrow = panel.dims(length(circleplot.object $ lines )))
36
-
37
- # loop to calculate lines of requisite location and colour
38
- line.data <- circleplot.object $ lines [[1 ]]
39
- line.list <- split(line.data , c(1 : nrow(line.data )))
40
- line.list <- lapply(line.list , function (x , plot.object , distance , options ){
41
- calc.lines(x , plot.object , distance , options )},
42
- plot.object = circleplot.object , distance = scale.distance , options = plot.options )
43
-
44
- # draw these lines
45
- invisible (lapply(line.list ,
46
- FUN = function (z , asymmetric , arrow.attr ){
47
- draw.curves(z )
48
- if (asymmetric )draw.arrows(z , arrow.attr )},
49
- asymmetric = attr(circleplot.object , " asymmetric" ), arrow.attr = plot.options $ arrows ))
50
-
51
- # add points or polygons, depending on style
52
- switch (style ,
53
- " classic" = {do.call(points ,
54
- as.list(circleplot.object $ points [, - which(colnames(circleplot.object $ points )== " labels" )]))},
55
- " pie" = {invisible (lapply(circleplot.object $ polygons , function (x ){do.call(polygon , x )}))},
56
- " clock" = {
57
- invisible (lapply(circleplot.object $ nodes , function (x ){do.call(lines , x )}))
58
- do.call(draw.circle , plot.options $ border [- which(names(plot.options $ border )== " tcl" )])}
59
- )
60
-
61
- # label points
62
- label.suppress.test <- is.logical(plot.options $ point.labels ) & length(plot.options $ point.labels )== 1
63
- if (label.suppress.test == FALSE ){
64
- labels.list <- split(circleplot.object $ labels , 1 : nrow(circleplot.object $ labels ))
65
- invisible (lapply(labels.list , FUN = function (x ){do.call(text , x )}))}
33
+
34
+ invisible (lapply(circleplot.object $ lines , function (a , add , circleplot.object , scale.distance , plot.options ){
35
+ if (add == FALSE ){
36
+ do.call(par , circleplot.object $ par )
37
+ do.call(plot , circleplot.object $ plot )}
38
+
39
+ # loop to calculate lines of requisite location and colour
40
+ # line.data<-circleplot.object$lines[[1]]
41
+ line.list <- split(a , c(1 : nrow(a )))
42
+ line.list <- lapply(line.list , function (x , plot.object , distance , options ){
43
+ calc.lines(x , plot.object , distance , options )},
44
+ plot.object = circleplot.object , distance = scale.distance , options = plot.options )
45
+
46
+ # draw these lines
47
+ invisible (lapply(line.list ,
48
+ FUN = function (z , asymmetric , arrow.attr ){
49
+ draw.curves(z )
50
+ if (asymmetric )draw.arrows(z , arrow.attr )},
51
+ asymmetric = attr(circleplot.object , " asymmetric" ), arrow.attr = plot.options $ arrows ))
52
+
53
+ # add points or polygons, depending on style
54
+ switch (style ,
55
+ " classic" = {do.call(points ,
56
+ as.list(circleplot.object $ points [, - which(colnames(circleplot.object $ points )== " labels" )]))},
57
+ " pie" = {invisible (lapply(circleplot.object $ polygons , function (x ){do.call(polygon , x )}))},
58
+ " clock" = {
59
+ invisible (lapply(circleplot.object $ nodes , function (x ){do.call(lines , x )}))
60
+ do.call(draw.circle , plot.options $ border [- which(names(plot.options $ border )== " tcl" )])}
61
+ )
62
+
63
+ # label points
64
+ label.suppress.test <- is.logical(plot.options $ point.labels ) & length(plot.options $ point.labels )== 1
65
+ if (label.suppress.test == FALSE ){
66
+ labels.list <- split(circleplot.object $ labels , 1 : nrow(circleplot.object $ labels ))
67
+ invisible (lapply(labels.list , FUN = function (x ){do.call(text , x )}))}
68
+
69
+ }, add = add , circleplot.object = circleplot.object , scale.distance = scale.distance , plot.options = plot.options ))
66
70
67
71
if (class(input )== " list" )par(mfrow = c(1 , 1 ))
68
72
0 commit comments