[RQt-devel] scale of view for some primitive doesn't work

Michael Lawrence lawrence.michael at gene.com
Fri Nov 12 00:39:34 CET 2010


This is by design. If this didn't work that way, then when the user zoomed
into a chromosome, for example, the text labels would get really stretched
out. Glyphs are the same way (they're essentially fancy characters). Zooming
into a scatterplot should not make the glyphs larger. Circles (after much
debate inside my head) behave the same as glyphs. This is because their
radius, like in a bubble plot, is derived from something other than the X
and Y axes.

Shapes however, like rectangles, polygons and paths, are zoomed. You expect
a mosaic plot rectangle or a map polygon to scale with the plot.

Are you sure you really need the text to scale with the zoom? Deepayan and I
decided a long time ago that zooming does not behave like a "magnifying
glass." It rescales the plot.

There are some ways to get around this if you really want to:
- Draw the text as a path.
- Use the "render" method on the scene to render to a QPicture, rescale that
and display it. This is how I imagined someone making a magnifying glass.
QPicture is a vectorized representation, so no nasty scaling artifacts are
introduced.

Michael

On Thu, Nov 11, 2010 at 3:24 PM, Tengfei Yin <yintengfei at gmail.com> wrote:

> Hi
>
> Here comes another question with text, please see the attached  code below,
> only rect could be resized,  when I call v$scale()
>
> text, circle doesn't change. it happens to visnab, the circular view, when
> I scale the view, every thing resize but the text, it's still in the same
> size.
>
> library(qtpaint)
> s <- qscene()
> test_layer <- qlayer(s,function(layer,painter){
>   qdrawRect(painter,30,30,70,70,stroke="blue")
>   qdrawCircle(painter,50,50,20,stroke="red")
>   qdrawText(painter,"TEST",50,50)
> },limits=qrect(0,0,100,100))
> v <- qplotView(s)
> v$show()
>
> v$scale(1.5,1.5)
>
> Thanks
>
> Tengfei
> --
> Tengfei Yin
> MCDB PhD student
> 1620 Howe Hall, 2274,
> Iowa State University
> Ames, IA,50011-2274
> Homepage: www.tengfei.name
>
>
>
> _______________________________________________
> 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/20101111/6e8664ee/attachment.htm>


More information about the Qtinterfaces-devel mailing list