[R] Greyed text in the background of a plot

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Sep 12 16:50:01 CEST 2008


An alternative is to use semi-transparency, which can be helpful if you 
want to do more than one such annoation.  E.g. add

text(1, 1, "More", col=rgb(0,0,0,0.2), cex=3)

to this example.  (I'd say it was closer to what "ghosted" might mean.)


On Fri, 12 Sep 2008, Mark Difford wrote:

>
> Hi Agustin,
>
>>> Is there any way of having a greyed ("ghosted") text...
>
> Yes!
>
> ##
> plot(1, type="n")
> text(1, "Old Grey Whistle Test", col="slategray4", cex=2)
> text(1, y=1.2, "OH!", col="grey95", cex=4)
>
> Then plot what you want on top. If you export or plot to a PDF/ps device the
> last-plotted items will overlie the first-plotted items. I think this is
> generally true.

Yes, part of R's pen-and-ink model of graphics.

> See:
> ?colors
> colors()
> ?text
> ?par
>
> Regards, Mark.
>
>
> Agustin Lobo-4 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
>>
>> ______________________________________________
>> 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.
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Greyed-text-in-the-background-of-a-plot-tp19456533p19457146.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list