emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dov Grobgeld <dov.grobgeld@gmail.com>
To: Dan Davison <dandavison7@gmail.com>
Cc: Jeff Horn <jrhorn424@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Generated images in buffer
Date: Sun, 28 Nov 2010 22:43:40 +0200	[thread overview]
Message-ID: <AANLkTikvdQoejvFLa9Yx1Dj-suiD37DRkbRZfVSHfX=D@mail.gmail.com> (raw)
In-Reply-To: <87y68d9x4w.fsf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1523 bytes --]

Thanks! This is exactly what I was looking for. And indeed it is as easy to
output a graph from python (or any other language) as it is from ditaa:

* A ditaa image
#+begin_src ditaa :file example.png
+---------+
| cBLU    |
|         |
|    +----+
|    |cPNK|
|    |    |
+----+----+
#+end_src

#+results:
[[file:example.png]]
* A Python image
#+begin_src python :file circle.png
import cairo,math, os

width, height = 256,256
surface = cairo.ImageSurface (cairo.FORMAT_ARGB32, width, height)
ctx = cairo.Context (surface)
ctx.set_source_rgb(0,0,0)
ctx.rectangle(0,0,width,height)
ctx.fill()
ctx.set_source_rgb(1,1,1)
ctx.move_to(width/2,height/2)
ctx.arc(width/2,height/2,width*0.25,0,math.pi*2)
ctx.fill()
surface.write_to_png("circle.png")
#+end_src

#+results:

[[file:circle.png]]

* A matplotlib graph from http://matplotlib.sourceforge.net

#+begin_src python :file graph.png
from pylab import *

t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s, linewidth=1.0)

xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
savefig("graph.png",dpi=50)
#+end_src

#+results:

[[file:graph.png]]

I'm wondering over one thing though. When exporting to HTML, the ditaa
source code is omitted, but the python source code is included. Is there any
way of controlling this in begin_src?

Thanks!
Dov


On Sun, Nov 28, 2010 at 19:27, Dan Davison <dandavison7@gmail.com> wrote:

>  (add-hook 'org-babel-after-execute-hook
>            (lambda () (org-display-inline-images nil t)))
>

[-- Attachment #1.2: Type: text/html, Size: 7070 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-11-28 20:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-28  7:04 Generated images in buffer Dov Grobgeld
2010-11-28  7:34 ` Jeff Horn
2010-11-28  8:11   ` Dov Grobgeld
2010-11-28 14:46     ` Eric Schulte
2010-11-28 17:27       ` Dan Davison
2010-11-28 20:43         ` Dov Grobgeld [this message]
2010-11-28 22:34           ` Dan Davison

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='AANLkTikvdQoejvFLa9Yx1Dj-suiD37DRkbRZfVSHfX=D@mail.gmail.com' \
    --to=dov.grobgeld@gmail.com \
    --cc=dandavison7@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jrhorn424@gmail.com \
    /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).