[R] how to enlarge the legend
j@zh@o @end|ng |rom ye@h@net
Mon Oct 10 03:01:36 CEST 2022
Thank you very much for the example. It works well.
On 2022/10/10 3:48, Uwe Ligges wrote:
> I'd propose:
> ltext <- "text"
> lobj <- legend("bottom", "", text.width=strwidth(ltext), fill = "gray",
> cex = 2)
> text(lobj$text, ltext)
> Uwe Ligges
> On 09.10.2022 16:54, Jinsong Zhao wrote:
>> Hi there,
>> in the following code, I'd like to enlarge the filled box but not the
>> legend text.
>> legend("topleft", "text", fill = "gray") # filled box is too small
>> legend("top", "text", fill = "gray", cex = 2) # filled box is ok but
>> text is too large
>> # I can use point to mimic filled box, but can not fill it with pattern
>> legend("left", "text", pch = 22, pt.bg = "gray", pt.cex =3)
>> I'd like to get filled box enlarged but with text not to be changed.
>> Is it possible?
>> Thanks in advance!
More information about the R-help