[R] Plot does not show in R

Sarah Goslee sarah.goslee at gmail.com
Mon Jul 7 18:07:43 CEST 2014


Hi,

Are you using the vennDiagram package? It's very important to specify.

If so, setting the argument filename=NULL then returns a grid object
(as stated in the help file), which you can then plot or do whatever
you wish with. A grid object is an R object that describes a plot, not
the plot itself.

http://stat.ethz.ch/R-manual/R-devel/library/grid/html/grid.grob.html
http://stat.ethz.ch/R-manual/R-devel/library/grid/html/grid.draw.html

Sarah

On Mon, Jul 7, 2014 at 11:42 AM, gktahon <Guillaume.Tahon at ugent.be> wrote:
> I'm trying to get my figure to open with R, but it does not come up.
> Here is my standard code:
>
> venn.diagram(
>         x = list(
>                 KP2 = c(2, 62, 22, 33, 11, 36, 26, 27, 28, 64, 5, 66, 10, 18, 68, 61, 6,
> 29, 19, 65, 30, 35, 32, 20, 69, 8, 31, 13, 21, 7),
>                 KP15 = c(2, 22, 39, 1, 14, 65, 67, 68, 1, 12, 23, 37, 4, 24, 25, 64, 52,
> 34, 9, 15, 13, 8, 16, 63, 3, 17),
>                 KP43 = c(39, 2, 49, 43, 51, 38, 56, 58, 60, 44, 54, 40, 50, 45, 57, 59,
> 46, 41, 47, 48, 42, 55, 53)
>                 ),
>         filename = "location\\nifH_AA_alles.jpg" ,
>         col = "transparent",
>         fill = c("red", "blue", "green"),
>         alpha = 0.5,
>         label.col = c("darkred", "white", "darkblue", "white", "white", "white",
> "darkgreen"),
>         cex = 2.5,
>         fontfamily = "serif",
>         fontface = "bold",
>         cat.default.pos = "text",
>         cat.col = c("darkred", "darkblue", "darkgreen"),
>         cat.cex = 2.5,
>         cat.fontfamily = "serif",
>         cat.dist = c(0.3, 0.4, 0.27),
>         cat.pos = 0
>         );
>
> This code saves the file to the desired location. However, I want the plot
> to open in the R interface, so I changed that line of the code to
> "filename=NULL". When I run the script afterwards, the plot does not open,
> instead, I get the following outputline:
>
> (polygon[GRID.polygon.1], polygon[GRID.polygon.2], polygon[GRID.polygon.3],
> polygon[GRID.polygon.4], polygon[GRID.polygon.5], polygon[GRID.polygon.6],
> text[GRID.text.7], text[GRID.text.8], text[GRID.text.9], text[GRID.text.10],
> text[GRID.text.11], text[GRID.text.12], text[GRID.text.13],
> text[GRID.text.14])
>
>
> Could anyone help me adapt the code so I get the plot opened in R?
>
> Many thanks in advance,
> Guillaume
>
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list