Browse Source

o-b-worg.org: expanding the explanation of the pie chart example

Dan Davison 16 years ago
parent
commit
5fbd0bfba6
1 changed files with 12 additions and 7 deletions
  1. 12 7
      org-babel-worg.org

+ 12 - 7
org-babel-worg.org

@@ -361,13 +361,16 @@ functions from many languages can work together.
 As an example, lets take some system diagnostics in the shell, and
 As an example, lets take some system diagnostics in the shell, and
 then graph them with R.
 then graph them with R.
 
 
-1. Shell source code
+1. First we create a code block containing shell code creating a list
+   of the directories in our home directory, together with their
+   sizes. Org-babel automatically converts the output into an org
+   table.
+   
 #+srcname: directories
 #+srcname: directories
    #+begin_src bash :results replace
    #+begin_src bash :results replace
    cd ~ && du -sc * |grep -v total
    cd ~ && du -sc * |grep -v total
    #+end_src
    #+end_src
-2. Results of the shell source code (on my system, grab this org-mode
-   files and try running it on your own)
+   
 #+resname: directories
 #+resname: directories
 |       72 | "Desktop"   |
 |       72 | "Desktop"   |
 | 12156104 | "Documents" |
 | 12156104 | "Documents" |
@@ -384,12 +387,14 @@ then graph them with R.
 |  3821872 | "mail"      |
 |  3821872 | "mail"      |
 | 10605392 | "src"       |
 | 10605392 | "src"       |
 |     1264 | "tools"     |
 |     1264 | "tools"     |
-3. R source code (which calls the previous shell source code)
-#+srcname: directory-pie
-   #+begin_src R :var dirs = directories :session R-pie-example
+2. Now we use a single line of R code to plot the data as a
+   pie-chart. Note the way that this source block uses the =srcname=
+   of the previous source block to obtain the data.
+#+srcname: directory-pie-chart(dirs = directories)
+   #+begin_src R :session R-pie-example
    pie(dirs[,1], labels = dirs[,2])
    pie(dirs[,1], labels = dirs[,2])
    #+end_src
    #+end_src
-4. Results of R code [[file:images/dirs.png]]
+ [[file:images/dirs.png]]
 
 
 * Multilingual spreadsheet plugins for org-mode
 * Multilingual spreadsheet plugins for org-mode
   :PROPERTIES:
   :PROPERTIES: