emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* rmarkdown-like production of multiple plots in org
@ 2020-03-31 19:23 Matt Price
  2020-03-31 20:12 ` John Hendy
  2020-04-02 17:39 ` Berry, Charles via General discussions about Org-mode.
  0 siblings, 2 replies; 5+ messages in thread
From: Matt Price @ 2020-03-31 19:23 UTC (permalink / raw)
  To: Org Mode

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

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: rmarkdown-like production of multiple plots in org
@ 2020-03-31 20:02 Thomas S. Dye
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas S. Dye @ 2020-03-31 20:02 UTC (permalink / raw)
  To: moptop99; +Cc: emacs-org list

Aloha Matt,

A guess based on my experience with ggplot2 is that the 
auto-naming and saving take place in the functions plot2() and 
plot4().  If so, then calling them from Org mode babel blocks will 
also get you auto-naming and saving.

I think you're right that you'll need to put each of the plots in 
its own babel source code block and then set up the html export to 
your satisfaction.  IIUC, these are the prices one pays for 
working in a system like Org mode which is both language agnostic 
and export target agnostic.  The rmarkdown/rstudio solution is 
nifty, but it is tied to one language and one export target.

hth,
Tom
--
Thomas S. Dye
https://tsdye.online/tsdye

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-02 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
2020-03-31 20:02 Thomas S. Dye

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