[RQt-devel] speed up parallel coordinates plot?

Michael Lawrence lawrence.michael at gene.com
Wed Aug 4 15:41:50 CEST 2010


Sorry if this was not made obvious, but you don't want to for() loop over
the drawing commands. They're vectorized, so just pass the vectors.

Also, in the future, please paste your output. Our systems could behave
differently.

I will document the qtpaint package after the talk today. qtbase is already
documented, btw.

Thanks,
Michael

On Wed, Aug 4, 2010 at 12:14 AM, Yihui Xie <xie at yihui.name> wrote:

> 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
> _______________________________________________
> Qtinterfaces-devel mailing list
> Qtinterfaces-devel at lists.r-forge.r-project.org
>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/qtinterfaces-devel/attachments/20100804/2ac4baa1/attachment.htm>


More information about the Qtinterfaces-devel mailing list