is it possible to display plots in an emacs buffer?

david.whiting at ncl.ac.uk david.whiting at ncl.ac.uk
Sat May 22 01:53:02 CEST 2004


On Fri, May 21, 2004 at 05:48:31PM +0000, David Whiting wrote:

[...]

> If all you want to do is display a plot, then you could create a png
> file and then display that using w3m:
> 
> (w3m-goto-url "file:///myplot.png")
> 
> At the moment this is still probably more work than you would want it to
> be, though.

If you have w3m working with emacs this function might do what you
want. Bind it to a key combination and it might be less work than
closing an X11 window.  It assumes that the line you are on when you
call this function is one that creates a plot.
                                                                                    
(defun R-plot-w3m ()
  "Display an R plot in an emacs buffer using w3m to produce the display."
  (interactive)
  (setq ess-command (comint-get-old-input-default))
  (ess-execute "png('/tmp/temp.png')")
  (ess-execute ess-command)
  (ess-execute "dev.off()")
  (w3m-goto-url "file:///tmp/temp.png"))

This seems to work okay for simple plots, but is giving me some issues
with lattice graphics.  This version is designed to demonstrate an idea
and needs more work to be really useful. 

Dave

-- 
David Whiting
Adult Morbidity and Mortality Project (AMMP)
PO Box 65243, Aga Khan Foundation Building - Ground Floor
Plot No 344 Urambo Street, Upanga, Dar es Salaam, Tanzania.

Tel: +255 22 2153388, Fax: +255 22 2153385
AMMP website: www.ncl.ac.uk/ammp

Against MS attachments. Why? See for example:
http://www.goldmark.org/netrants/no-word/attach.html
http://linuxtoday.com/news_story.php3?ltsn=2002-01-11-002-20-OP




More information about the ESS-help mailing list