0

There are some old threads asking about getting R to display its graphics in an emacs window (e.g. ESS plot directly to an Emacs buffer?) and the ESS manual says,

11.6.2 Using ESS with windowing devices

Of course, the ideal way to use graphics with ESS is to use a windowing system. Under X Windows, or X11, this requires that the DISPLAY environment variable be appropriately set.

But provides no information on how to do so and my google searches only return results similar to the above references. Can someone direct me to a resource to explain how to set up my ess.el file to use emacs as R's DISPLAY environment?

3
  • I think you are misunderstanding this. There is no ESS configuration that will make it display graphics in an emacs buffer. It will display them in a window created by your operating system. This shouldn't require any configuration on your part. If this doesn't work, we'll need more info about your system. If you want figures in an Emacs buffer, you'll need to try some of the ideas in the linked question.
    – Tyler
    Commented Dec 17, 2021 at 16:57
  • Ah.. got it. Do you want to post your comment as an answer so I can accept it? Commented Dec 17, 2021 at 18:43
  • @db48x already posted an extended version of this explanation as an answer
    – Tyler
    Commented Dec 17, 2021 at 18:54

1 Answer 1

2

That’s not what that sentence means. Emacs is not an X server. This sentence means that if you have an X server available, and DISPLAY is set to the right value, then R will connect to the X server and open up it’s own GUI windows.

If you are using the Emacs gui, than this is certainly already set up correctly. If you are using Emacs in a terminal emulator, then you can verify that DISPLAY is set in a shell inside that terminal emulator by running echo $DISPLAY. If it is, then Emacs will inherit that setting from the shell and R will inherit it from Emacs, and R will be able to open its own GUI windows. If it isn’t, then you need to consult the documentation for your terminal emulator.

If you really want R to plot things directly into an Emacs buffer, then the usual way to do it is to have R output an image to a file, and then arrange to have the file displayed by Emacs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.