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

Michael Lawrence lawrence.michael at gene.com
Fri Nov 12 14:09:35 CET 2010


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

>
>
> On Thu, Nov 11, 2010 at 10:27 PM, Michael Lawrence <
> lawrence.michael at gene.com> wrote:
>
>>
>>
>> On Thu, Nov 11, 2010 at 7:32 PM, Tengfei Yin <yintengfei at gmail.com>wrote:
>>
>>> So even when you use view$rotate(), the text direction won't change..is
>>> this also what we expected to see?
>>>
>>>
>> Yes. I can see how that may not always be desirable, but it would be tough
>> to work around it. That is, I cannot tease out the rotation from the rest of
>> the transformation. In the case of a word cloud, I think it would be
>> desirable, i.e., one is thinking of the text as glyphs that are independent
>> of the scales.
>>
>>
>>> and by the way, do you know any way to change to text size, the use case
>>> here is sth like "tag cloud", but I guess I can draw text as path to solve
>>> this problem.
>>>
>>>
>> Just change the font.. do you want some sort of vectorized "cex" argument
>> to qdrawText? Might not be that hard to add.
>>
>
> Yes, if you don't mind spend some time on it, it will be really nice to
> have a control over the text size, e.g. when I plot a sequence data, like
> ACTGGGC....I can resize one single character  to address the mis-alignment.
>

You mean like a sequence logo plot, based on the counts of each base? Sweet
idea. The feature is committed, have fun.


>
>> Michael
>>
>>
>>>
>>> On Thu, Nov 11, 2010 at 6:14 PM, Tengfei Yin <yintengfei at gmail.com>wrote:
>>>
>>>>
>>>>
>>>> On Thu, Nov 11, 2010 at 5:39 PM, Michael Lawrence <
>>>> lawrence.michael at gene.com> wrote:
>>>>
>>>>> 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.
>>>>>
>>>>>
>>>> This make sense to me, in most cases, i guess people won't expect the
>>>> circle or text to be  zoomed in.
>>>>
>>>> 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.
>>>>>
>>>>>
>>>> No, you don't have to change that, it's convenient so far, I am just
>>>> curious why this doesn't work for text and circle, because in other rare
>>>> case, I will draw very small text as labels of axis for one circular track,
>>>> or if I draw points around the circular track, I am still expecting the
>>>> points will be zoomed in when I rescale the view. I guess I am confused the
>>>> "rescale of the view" with the one you defined with Deepayan, but it make
>>>> sense to me.
>>>>
>>>> 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.
>>>>>
>>>>
>>>> Thanks, I think I need to do it in this way, if I really need them to be
>>>> rescaled.  I never try QPicture before, I will take a look at it.
>>>>
>>>>
>>>>> 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
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Tengfei Yin
>>>> MCDB PhD student
>>>> 1620 Howe Hall, 2274,
>>>> Iowa State University
>>>> Ames, IA,50011-2274
>>>> Homepage: www.tengfei.name
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> 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
>>>
>>>
>>
>
>
> --
> Tengfei Yin
> MCDB PhD student
> 1620 Howe Hall, 2274,
> Iowa State University
> Ames, IA,50011-2274
> Homepage: www.tengfei.name
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/qtinterfaces-devel/attachments/20101112/fae1dc5e/attachment.htm>


More information about the Qtinterfaces-devel mailing list