[R] Save a graph file use jpeg(file=file)

Ebert,Timothy Aaron tebert @end|ng |rom u||@edu
Wed Jan 5 20:57:07 CET 2022

The simple solution for Windows is to use (windows icon) + shift + s. You then select a portion of your screen and it gets copied to your clipboard. You can then paste that into your document. Of course this will not work if it is important that the reader is able to rotate the graphic. 

-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Sorkin, John
Sent: Wednesday, January 5, 2022 2:46 PM
To: r-help using r-project.org (r-help using r-project.org) <r-help using r-project.org>
Subject: [R] Save a graph file use jpeg(file=file)

[External Email]

I am trying to create a 3-D graph (using scatter3d) and save the graph to a file so I can insert the graph into a manuscript. I am able to create the graph. When I run the code below an RGL window opens that has the graph. The file is saved to disk after dev.odd() runs. Unfortunately, when I open the saved file, all I see is a white window. Can someone tell me how to have the file so I can subsequently read and place the file in a paper? The problem occurs regardless of the format in which I try to save the file, e.g. png, tiff.

x <- 1:10
y <- 2:11
z <- y+rnorm(10)

gpathj <- file.path("C:","LAL","test.jpeg") gpathj jpeg(file = gpathj) par(mai = c(0.5, 0.5, 0.5, 0.5)) scatter3d(z=ForGraph$x,
          zlab="VTE Rate (%)",axis.ticks=TRUE)

Thank you,

        [[alternative HTML version deleted]]

R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=9AMmnr8IGTA1cG1beZmaYb3IDwiObdbc6OI3PkjbwbniR_W4i9hcMzYbyzYTE-gS&s=2IkUWGiufhME4qqOuIRPGShSOMTsStDDwSkLoTt4zdM&e=
PLEASE do read the posting guide https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=9AMmnr8IGTA1cG1beZmaYb3IDwiObdbc6OI3PkjbwbniR_W4i9hcMzYbyzYTE-gS&s=NHEqSQ0hFwKq_5lC0CqVYr53rYXLTpdWVNXZMCEMLLI&e=
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list