[R] Change the position of label when using R package eulerr

David Winsemius dw|n@em|u@ @end|ng |rom comc@@t@net
Fri Sep 14 03:56:58 CEST 2018


> On Sep 13, 2018, at 2:31 PM, Aimin Yan <aimin.at.work using gmail.com> wrote:
> 
> I am using eulerr to get venn.
> My code is like:
> 
> fit1 <- euler(c("ciLAD" = 785, "LAD" = 565, "nonXL_MEF" = 167,
>                    "ciLAD&LAD" = 3, "ciLAD&nonXL_MEF" = 101,
> "LAD&nonXL_MEF" = 541,
>                    "ciLAD&LAD&nonXL_MEF" = 2),shape = "ellipse")
> 
> plot(fit1,quantities = TRUE,fill = rainbow(7),lty = 1:2,labels = list(font
> = 1),alpha=0.7)
> 
> After I get the figure, I find the position of some  labels need to be
> adjusted.
> 
> Does anyone has some idea about how to process this?

Looking at the code of plot.euler we see that the plotting paradigm is grid. So you could assign the output to a data.object name, search for list items that match the names of the labels you want to reposition, and modify the position values. You would need to be more specific, if you want a worked example.

As far as I can see the lables and postions are fairly deep inside a list structure:

 $ children     :List of 1
  ..$ GRID.gTree.12:List of 5
  .. ..$ children
         $ diagram.grob.1     
            $children
.. .. .. .. ..$ labels.grob    :List of 11
  .. .. .. .. .. ..$ label        : chr [1:3] "ciLAD" "LAD" "nonXL_MEF"
  .. .. .. .. .. ..$ x            : 'unit' num [1:3] -18.1native 69.2native 11.9native
  .. .. .. .. .. .. ..- attr(*, "valid.unit")= int 4
  .. .. .. .. .. .. ..- attr(*, "unit")= chr "native"
  .. .. .. .. .. ..$ y            : 'unit' num [1:3] -17.86native 5.24native 27.86native
  .. .. .. .. .. .. ..- attr(*, "valid.unit")= int 4
  .. .. .. .. .. .. ..- attr(*, "unit")= chr "native"

-- 
David.
> 
> 
> Thank you,
> 
> Aimin
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law




More information about the R-help mailing list