[RQt-devel] segment glyph

Michael Lawrence lawrence.michael at gene.com
Thu Oct 21 07:23:19 CEST 2010


I'll look into this. Just FYI, this works fine when OpenGL is disabled by
passing opengl=FALSE to qplotView(). Need to get this working with GL.

Michael

On Wed, Oct 20, 2010 at 3:18 PM, Yihui Xie <xieyihui at gmail.com> wrote:

> Hi,
>
> I want to define a glyph which is a short segment as follows, but when
> the slope b=0, the glyph looks weird on screen (it is a filled
> square); other slopes are fine. I don't know what's going on:
>
> library(qtpaint)
> ## x: length; b: slope
> qglyphSegment <- function(x = 5, b = 0) {
>  glyph <- Qt$QPainterPath()
>  x0 <- x * cos(atan(b))
>  y0 <- x * sin(atan(b))
>  glyph$moveTo(-x0, -y0)
>  glyph$lineTo(x0, y0)
> #  glyph$closeSubpath()
>  glyph
> }
>
> s <- qscene()
> test_layer <- qlayer(s, function(layer, painter) {
>    qdrawGlyph(painter, qglyphSegment(), 1:10, .5, stroke = 'black')
>    qdrawGlyph(painter, qglyphSegment(10, 1), 1:10, .7, stroke = 'black')
>    qdrawGlyph(painter, qglyphSegment(10, -1), 1:10, .3, stroke = 'black')
> }, limits=qrect(0,0,11,1))
> qplotView(s)
> ## see the screenshot attached
>
>
> Thanks!
>
> Regards,
> Yihui
> --
> Yihui Xie <xieyihui at gmail.com>
> Phone: 515-294-2465 Web: http://yihui.name
> Department of Statistics, Iowa State University
> 2215 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/20101020/f760b55f/attachment.htm>


More information about the Qtinterfaces-devel mailing list