[R] [FORGED] How to remove box in Venn plots (Vennerable package, uses grid) - similar to bty="n" in standard plots

DE LAS HERAS Jose J.delasHeras at ed.ac.uk
Mon Nov 14 14:08:17 CET 2016


Hi,


The grid.ls() and grid.remove() approach worked beautifully to remove the box, thank you! Because the box is the first thing to be drawn, it is the first object shown by grid.ls(), so I can easily add a line of code to automatically remove the box. Result!


Although I'd still like to know how one chooses not to plot that box in the first place. I really must study a little the grid package. I've survived using base R plots and they work very nicely, but it looks like you can do a lot of cool stuff with grid.


In case you might know the answer and feel like adding a comment here (I'm already very happy with the grid.ls() approach, thanks! :)) this is a simple code example without making it look pretty or anything:




library(Vennerable)
groups<-list(set1=1:100, set2=80:120)
V<-Venn(groups)
C<-compute.Venn(V)
X11(w=7,h=7)
grid.newpage()
plot(C)

class(C)
[1] "VennDrawing"
attr(,"package")
[1] "Vennerable"

I don't want the black box around the diagram.
I was able to overwrite it with a white box like this:

vp=viewport(x=0.5, y=0.5, width=0.95, height=0.75)
pushViewport(vp)
grid.rect(gp=gpar(lty=1, col="white", lwd=15))
upViewport() # needs to be executed to return focus upwards

but as the box has different dimensions depending on the actual sets being drawn, the width and height must be found empirically each time. A bit boring it you need to produce a bunch of figures at once.

I was wondering what parameter I could include in the call to 'plot' that would prevent the box from being drawn. Usually this is achieved with bty="n", but the method for plotting a "VennDrawing" structure uses the grid package and I'm lost there at the moment.

Thank you for your help again, grid.ls() etc is a very cool and flexible approach

Jose




________________________________
From: Paul Murrell <paul at stat.auckland.ac.nz>
Sent: 13 November 2016 19:57
To: DE LAS HERAS Jose; R-help at r-project.org
Subject: Re: [FORGED] [R] How to remove box in Venn plots (Vennerable package, uses grid) - similar to bty="n" in standard plots

Hi

Can you supply some example code?

You might get some joy from grid.ls() to identify the box followed by
grid.remove() to get rid of it;  some example code would allow me to
provide more detailed advice.

Paul

On 12/11/16 05:12, DE LAS HERAS Jose wrote:
> I'm using the package Vennerable to make Venn diagrams, but it always
> makes a box around the diagram.
>
> Using standard R plots I could eliminate that by indicating
>
>
> bty="n"
>
>
> but it seems Vennerable uses the Grid package to generate its plots
> and I'm not really familiar enough with Grid. I was looking at the
> documentation but I can't seem to find a way to achieve that. I'd
> even be happy drawing a white rectangle with wide lines to overplot
> the box, but there must be a way to not draw the box in the first
> place.
>
>
> Anybody knows how?
>
>
> Jose
>
> --
>
> Dr. Jose I. de las Heras The Wellcome Trust Centre for Cell Biology
> Swann Building Max Born Crescent University of Edinburgh Edinburgh
> EH9 3BF UK
>
> Phone: +44 (0)131 6507090
>
> Fax:  +44 (0)131 6507360
>
>
>
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
>
> ______________________________________________ R-help at r-project.org
> mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the
R-help -- Main R Mailing List: Primary help - Homepage - SfS<https://stat.ethz.ch/mailman/listinfo/r-help>
stat.ethz.ch
The main R mailing list, for announcements about the development of R and the availability of new code, questions and answers about problems and solutions using R ...



> posting guide http://www.R-project.org/posting-guide.html and provide
> commented, minimal, self-contained, reproducible code.
>

--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/
Paul Murrell's Home Page<http://www.stat.auckland.ac.nz/~paul/>
www.stat.auckland.ac.nz
Department. My department home page. Research. The home page for R: A language and environment for computing and graphics (my R graphics todo list).



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20161114/763f5215/attachment.pl>


More information about the R-help mailing list