emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Roger Mason <rmason@mun.ca>
To: orgmode <emacs-orgmode@gnu.org>
Subject: Plotting with R
Date: Sun, 15 Aug 2021 10:47:02 -0230	[thread overview]
Message-ID: <y65h7fq6e5t.fsf@mun.ca> (raw)

Hello,

I want graphics output from R:

#+begin_src R :results output grahics file :file coa_vs_a.pdf :exports results 
library(tidyverse)
library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user="rmason",dbname="test")
rs <- dbSendQuery(con,"with CTE as (select split_part(split_part(lattice_out, E'\n', 13), ' ', 18) as c,
 split_part(split_part(lattice_out, E'\n', 11), ' ', 11) as a
 from results where timestamp like '20210814-071%' order by a)
 select cast(a as double precision), cast(c as double precision)/ cast(a as float) as coa from CTE;")
df <- fetch(rs)
theplot <- ggplot(df,aes(x=a,y=coa)) + geom_point()
theplot
#+end_src

What I expect is a file 'coa_vs_a.pdf' on my filesystem & a link to it
in the org buffer.  What I get is a file 'Rplots.pdf' and an empty file
'coa_vs_a.pdf' with a link to the latter in the org buffer.

I've searched this topic and I _think_ the invocation above, one of many
I've tried, should work.

GNU Emacs 27.2 (build 1, amd64-portbld-freebsd11.4, X toolkit, cairo
version 1.16.0, Xaw3d scroll bars)

Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @
/home/rmason/.emacs.d/org-git/lisp/)

Thanks for your help.

Roger


             reply	other threads:[~2021-08-15 13:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15 13:17 Roger Mason [this message]
2021-08-15 13:31 ` Plotting with R Pedro Bruel
2021-08-15 14:14   ` Roger Mason
2021-08-15 14:34     ` Pedro Bruel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=y65h7fq6e5t.fsf@mun.ca \
    --to=rmason@mun.ca \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).