> On Sep 14, 2018, at 2:03 PM, Aimin Yan <aimin.at.w...@gmail.com> wrote:
> 
> Thank you,
> 
> I figure out a way like this:
> 
> 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)
>    
> grid.ls()
> t <- grid.get("quantities.grob")
> names(t)
> 
> # Change these value will change the location of label.
>  
> grid.edit("quantities.grob",x=unit.c(unit(-14.9884684724791, "native"),
>                                          unit(-14.883684319653, "native"),
>                                          unit(13.9805892820006, "native"),
>                                          unit(-12.8808987356981, "native"),
>                                          unit(-11.488226371243, "native"),
>                                          unit(-9.51474016085318, "native"),
>                                          unit(-1.00436055190216, "native")))
>                 
> grid.edit("quantities.grob",y=unit.c(unit(-8.07672595120493, "native"),
>                                          unit(4.78718651828883, "native"),
>                                          unit(0.25941593099694, "native"),
>                                          unit(-4.32200781461293, "native"),
>                                          unit(25.7349463488991, "native"),
>                                          unit(-22.7610031110325, "native"),
>                                          unit(14.5001560838519, "native")))
> 
> However, here I just want to change the x and y  value of 4th label, does 
> anyone know how to set it?

If the t object were a complete grid object, it might have been:

grid.edit("quantities.grob", x[[4]]= unit(-12.8808987356981, "native")
           )               
grid.edit("quantities.grob", y[[4]]= unit(-4.32200781461293, "native"),
           )


But I don't think that will succeed since you never assigned the value of the 
plot operation to a name. Instead you pulled out part of the grid object that 
was sitting "free" and unassigned to a name. If you assign that value of 
plot(....) to `my.plot` you get:

 grid.ls(my.plot)
euler.diagram
  GRID.gTree.11
    diagram.grob.1
      fills.grob.1
      fills.grob.2
      fills.grob.3
      fills.grob.4
      fills.grob.5
      fills.grob.6
      fills.grob.7
      edges.grob
      labels.grob
      quantities.grob

I think you need to work with the tutorials in the grid package.

Look at:

help("grid-package")

-- 
David.

> 
> Aimin
> 
> On Thu, Sep 13, 2018 at 9:56 PM David Winsemius <dwinsem...@comcast.net> 
> wrote:
> 
> > On Sep 13, 2018, at 2:31 PM, Aimin Yan <aimin.at.w...@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@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
> 
> 
> 
> 
> 

David Winsemius
Alameda, CA, USA

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

______________________________________________
R-help@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.

Reply via email to