[RQt-devel] speed up parallel coordinates plot?

Yihui Xie xie at yihui.name
Wed Aug 4 09:14:31 CEST 2010


Hi all,

According to the suggestion in section 2.4 of the qtpaint vignette,
drawing segments will be generally faster than lines (if I understand
correctly). However, the experiment below shows segments might not be
faster (or even slower).

## speed for segments and lines?

library(qtpaint)

n=1e5; p=10
test=matrix(runif(n*p),ncol=p)
col=rainbow(n)
qtest1 = function(item, painter, exposed) {
print(system.time({
        for (i in 1:n) {
            qdrawLine(painter, 1:p, test[i, ], stroke = col[i])
        }
}))
}
qtest2 = function(item, painter, exposed) {
print(system.time({
        for (i in 1:n) {
	    qdrawSegment(painter, 1:(p-1), test[i, 1:(p-1)], 2:p, test[i,
2:p], stroke = col[i])
        }
}))
}

if (exists('scene')) rm(scene)
scene=qscene()
qlayer(scene, qtest1, limits = qrect(c(1,p),c(0,1)))
qplotView(scene = scene)

if (exists('scene')) rm(scene)
scene=qscene()
qlayer(scene, qtest2, limits = qrect(c(1,p),c(0,1)))
qplotView(scene = scene)

###################################################3


I guess the reason is there are not too many places to join among the
lines, which is the case in the parallel coordinates plot I've been
working on. The speed for interaction will be slow when the size of
data exceeds 1000x10, so I wonder if there are approaches to draw a
lot of lines/segments faster. (Using glyphs?)

The source code for the par-coord plot is here:
http://github.com/bigbear/cranvas/tree/master/Yihui/ (qpcpEx.R
contains several examples)

Thanks!

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-6609 Web: http://yihui.name
Department of Statistics, Iowa State University
3211 Snedecor Hall, Ames, IA


More information about the Qtinterfaces-devel mailing list