emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Price <moptop99@gmail.com>
To: "Berry, Charles" <ccberry@health.ucsd.edu>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: rmarkdown-like production of multiple plots in org
Date: Thu, 2 Apr 2020 13:52:24 -0400	[thread overview]
Message-ID: <CAN_Dec8GiMmRt0NarWZ3tWKPHDhoLSjaSmUSiOOU-8DkZ3jOew@mail.gmail.com> (raw)
In-Reply-To: <F5E9FA07-5F3B-4EEC-899B-51C3523CF67A@ucsd.edu>

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

Thanks Chuck and all other respondents.  Huh. I'll keep experimenting. I
like Chuck's idea of helper function that pipes theoutput as described but
for now, it might actually beeasier to stay with Rmarkdown (!). thanks, Matt

On Thu, Apr 2, 2020 at 1:39 PM Berry, Charles <ccberry@health.ucsd.edu>
wrote:

>
>
> > On Mar 31, 2020, at 12:23 PM, Matt Price <moptop99@gmail.com> wrote:
> >
> > I'm completely new to R.
> >
> > I've started working with a project that creates plots using the ggplot
> package -- so by default it creates grid objects, rather than writing to
> files.
> >
> > In rmarkdown/rstudio, I can write something like this in a SOMEFILE.Rmd
> :
> >
> > ```
> > install_github('eeholmes/CoV19')
> > library(CoV19)
> > getdata();
> > plot4(world, 'Ontario Canada')
> > plot2(world, 'Italy')
> > plot4(states, "WA")
> > ```
> >
> > I sort of love how the rmarkdown package will just create all 3 of those
> plots, save them to auto-named files, and render to HTML.
>
> Actually, this is knitr (which rmarkdown Imports) at work.  There are
> options as to how knitr will handle multiple plots in a chunk as described
> in
>
> https://yihui.org/knitr/options/#plots
>
> (which include `fig.show="animate"' to create an animation based on
> multiple plots!)
>
> So this applies to various filetypes in addition to *.Rmd (*.Rnw, for
> one).
>
>
> >  In RStudio, running just that block will also create all three blocks
> and display them in the editor.
> >
> > By contrast, creating a series of many plots in org is fairly tedious.
> I have to name the plot individually & put each function call in its own
> src block. Is there any way to mimic the behaviour of rmarkdown instead? I
> odn't understand babel or R enough to really even see how something like
> that could be implemented, but I'd appreciate some pointers.  Thank you!
>
> Getting babel to handle this seamlessly would be a significant effort.
>
> You can use ox-ravel (https://github.com/chasberry/orgmode-accessories.git)
> to export to *.Rmd and then render the result.  However, that does not have
> the interactivity of `org-babel-execute-src-block' and does not insert the
> graphics into the *.org file.
>
> I suppose that a function could be created to narrow to the src block,
> export it as *.Rmd to a buffer, run that buffer as the `text' arg of
> knitr::knit, then add links for the png's back to the *.org file. I haven't
> thought much about this - getting this to work in a simple case would not
> be too hard, but there may be a can of worms that this approach opens.
>
> HTH,
>
> Chuck
>
>
>

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

  reply	other threads:[~2020-04-02 17:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 19:23 rmarkdown-like production of multiple plots in org Matt Price
2020-03-31 20:12 ` John Hendy
2020-04-02 17:39 ` Berry, Charles via General discussions about Org-mode.
2020-04-02 17:52   ` Matt Price [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-03-31 20:02 Thomas S. Dye

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=CAN_Dec8GiMmRt0NarWZ3tWKPHDhoLSjaSmUSiOOU-8DkZ3jOew@mail.gmail.com \
    --to=moptop99@gmail.com \
    --cc=ccberry@health.ucsd.edu \
    --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).