[R] Greyed text in the background of a plot
Yihui Xie
xieyihui at gmail.com
Sat Sep 13 17:20:08 CEST 2008
Hi Mark,
Actually I have been considering for a long time to include such kinds
of animations in the package 'animation'. In the next release (1.0-2),
you will see a new function 'Rosling.bubbles()', which can generate
animations like:
http://animation.yihui.name/da:ts:hans_rosling_s_talk
Of course the example is meaningless currently because I'm not using
real data as Hans Rosling did.
Regards,
Yihui
On Fri, Sep 12, 2008 at 10:51 PM, Mark Difford <mark_difford at yahoo.co.uk> wrote:
>
> Hi Yihui,
>
> That's good, I like it! Very nice site.
>
> Regards, Mark.
>
>
> Yihui Xie wrote:
>>
>> Well, his talk seems to have attracted a lot of people... You may
>> simply use gray text in your plot. Here is an example:
>>
>> ##################################################
>> x = runif(10)
>> y = runif(10)
>> z = runif(10, 0.1, 0.3)
>> cl = rgb(runif(10), runif(10), runif(10), 0.5) # transparent colors!
>> par(mar = c(4, 4, 0.2, 0.2))
>> for (i in 1917:2007) {
>> x = x + rnorm(10, 0, 0.02)
>> y = y + rnorm(10, 0, 0.02)
>> z = abs(z + rnorm(10, 0, 0.05))
>> plot(x, y, xlim = c(0, 1), ylim = c(0, 1), type = "n", panel.first = {
>> grid()
>> text(0.5, 0.5, i, cex = 5, col = "gray") # here is the text!
>> })
>> symbols(x, y, circles = z, add = T, bg = cl, inches = 0.8)
>> box()
>> Sys.sleep(0.2)
>> }
>> ##################################################
>>
>> Not difficult at all, right? :)
>>
>> BTW, if you are interested in such animations, you may as well take a
>> look at my "animation" package:
>> http://cran.r-project.org/web/packages/animation/index.html
>> http://animation.yihui.name/
>>
>> Regards,
>> Yihui
>> - Show quoted text -
>>
>> On Fri, Sep 12, 2008 at 8:35 PM, Agustin Lobo <aloboaleu at gmail.com> wrote:
>>> Hi!
>>>
>>> Is there any way of having a greyed ("ghosted") text
>>> (i.e, 2006) in the background of a plot?
>>> I'm making a dynamic plot and would like to show the
>>> year of each time step as a big greyed text in the background.
>>>
>>> (the idea comes from Hans Rosling video:
>>> http://video.google.com/videoplay?docid=4237353244338529080&sourceid=searchfeed
>>> )
>>>
>>> Thanks
>>>
>>> Agus
>>> --
>>> Dr. Agustin Lobo
>>> Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
>>> LLuis Sole Sabaris s/n
>>> 08028 Barcelona
>>> Spain
>>> Tel. 34 934095410
>>> Fax. 34 934110012
>>> email: Agustin.Lobo at ija.csic.es
>>> http://www.ija.csic.es/gt/obster
>>>
>>
>> --
>> Yihui Xie <xieyihui at gmail.com>
>> Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
>> Mobile: +86-15810805877
>> Homepage: http://www.yihui.name
>> School of Statistics, Room 1037, Mingde Main Building,
>> Renmin University of China, Beijing, 100872, China
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
--
Yihui Xie <xieyihui at gmail.com>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China
More information about the R-help
mailing list