Plot does not show in R

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Plot does not show in R

gktahon
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
Reply | Threaded
Open this post in threaded view
|

Re: Plot does not show in R

Alfonso de Uña
Hi,

Try this, It works for me.

venn.plot<-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 = NULL ,
  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
)
grid.draw(venn.plot);


2014-07-07 17:42 GMT+02:00 gktahon <[hidden email]>:

> 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
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Plot-does-not-show-in-R-tp4693637.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> 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.
>


--
Un saludo
Alfonso de Uña
www.farmerdev.com

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] mailing list
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 | Threaded
Open this post in threaded view
|

Re: Plot does not show in R

Sarah Goslee
In reply to this post by gktahon
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 <[hidden email]> 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

______________________________________________
[hidden email] mailing list
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 | Threaded
Open this post in threaded view
|

RE: Plot does not show in R

gktahon
In reply to this post by Alfonso de Uña

Works like a charm, thank you very much for your help!

 

Logo_LM-UGent

Guillaume Tahon (PhD Student)

Ghent University, Faculty of Sciences

Laboratory of Microbiology, K.L. Ledeganckstraat 35 B-9000 Gent

T +32 (0)9 264 5134

F +32 (0)9 264 5092

E-mail: [hidden email]

Web: www.lm.ugent.be

 

Van: Alfonso de Uña [via R] [mailto:[hidden email]]
Verzonden: maandag 7 juli 2014 19:39
Aan: gktahon
Onderwerp: Re: Plot does not show in R

 

Hi,

Try this, It works for me.

venn.plot<-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 = NULL ,
  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
)
grid.draw(venn.plot);


2014-07-07 17:42 GMT+02:00 gktahon <[hidden email]>:


> 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
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Plot-does-not-show-in-R-tp4693637.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> 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.
>


--
Un saludo
Alfonso de Uña
www.farmerdev.com

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] mailing list
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.


If you reply to this email, your message will be added to the discussion below:

http://r.789695.n4.nabble.com/Plot-does-not-show-in-R-tp4693637p4693646.html

To unsubscribe from Plot does not show in R, click here.
NAML