emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Pedro Bruel <pedro.bruel@gmail.com>
To: Roger Mason <rmason@mun.ca>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: Plotting with R
Date: Sun, 15 Aug 2021 10:31:30 -0300	[thread overview]
Message-ID: <CAHmvSw940BxHSRwEz+5EnsirVpwiCUaeZAXTw19bi-HZ0zcp8A@mail.gmail.com> (raw)
In-Reply-To: <y65h7fq6e5t.fsf@mun.ca>

[-- Attachment #1: Type: text/plain, Size: 1541 bytes --]

Hi Roger,

There's a typo on your source block header, it should be "output graphics",
this would probably produce the output you're getting now.

Thanks,
Pedro


Le dim. 15 août 2021 à 10:17, Roger Mason <rmason@mun.ca> a écrit :

> 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
>
>

[-- Attachment #2: Type: text/html, Size: 2134 bytes --]

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15 13:17 Plotting with R Roger Mason
2021-08-15 13:31 ` Pedro Bruel [this message]
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=CAHmvSw940BxHSRwEz+5EnsirVpwiCUaeZAXTw19bi-HZ0zcp8A@mail.gmail.com \
    --to=pedro.bruel@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rmason@mun.ca \
    /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).