Nick Reich
nick.****@gmail*****
Tue Jun 13 23:53:44 JST 2006
Kasper- Thanks for your help here. I am indeed trying to use X11 as the plotting device. Your explanation of these different environment variable settings is very instructive. However, I'm still running into a problem when trying to use Carbon Emacs interactively. I created the ~/.profile file and restarted my computer. Here is what I tried next: If I start up X11 and type the command $> R to get R started, I can use graphical commands (e.g. plot(1:10)) and the plot displays in a new window. The result from the command line for the getenv query in X11 is: R> Sys.getenv("DISPLAY") DISPLAY ":0.0" However, when I open CarbonEmacs, start R using "M-x R" and enter the same query I have the following result: R> Sys.getenv("DISPLAY") DISPLAY "" I tried plotting something and no new window popped up. So I set the DISPLAY variable locally by entering: R> Sys.putenv(DISPLAY=":0.0") And then checked that it was set right: R> Sys.getenv("DISPLAY") DISPLAY ":0.0" But still, when I enter a plotting command no window pops up and the Rplots.ps file is in my working directory. Are there other modifications I need to make for the X11 server to be recognized by CarbonEmacs? Thanks again for your help, Nick On Jun 12, 2006, at 7:13 PM, Kasper Daniel Hansen wrote: > Hi Nick > > On the Mac you have two screen plotting devices: the X11 interface > and the Aqua interface. I assume you are interested in getting X11 to > work. For that to happen you need to > 1) Install and start the X11 server from the development tools > 2) Make sure your DISPLAY variable is set > Since you can do everything in a terminal I assume that X11 is > installed and started. You now need to make the R runing inside > Carbon Emacs aware of your display setting. One way to make sure that > it works is doing > R> Sys.putenv(DISPLAY = ":0.0") > this sets the environment variable from inside of R. You can check > what the current value is by doing \ > R> Sys.getenv("DISPLAY") > The reason why you get a Rplot.ps file is that R at startup does not > detect X11 and then it uses the postscript device as the default > device (the plot command writes to the default device per .... > default :) > > If you want a more permanent solution (and you do) you can put it > inside ~/.profile so that this file contains the following line > export DISPLAY=:0.0 > You may have to log out and back in again for this to work. The > advantage of putting it in .profile is that it will work for other > applications too. Another way, which is R specific, is to put the > command above inside an R configuration file. There are several > choices (~/.Renviron, ~/.Rprofile) , but some of them will not work > if you need to run R in BATCH mode. I suggest you go the .profile > route. The reason why it works under the terminal is probably because > you have some display setting which is not being detected outside the > terminal (note again, that you may have to log out and log in again > fro this to work). > > As you can guess, I am using R under ESS without any problems. Please > get back if the above does not help. In that case, please post the > results of Sys.getenv("DISPLAY") from both the terminal version of > ESS and the Carbon Emacs version. > > /Kasper > > > > On Jun 12, 2006, at 8:15 AM, Nick Reich wrote: > >> Hello, >> >> I am using R (the statistical software) with this Emacs package and >> am trying to have graphical windows pop-up as I work in my >> interactive session with R. For example, I'd like to type "plot >> (rnorm >> (50))" and have the little R plot of these fifty observations from a >> normal distribution be displayed in a new graphical window. This is >> possible when running emacs in a terminal-type environment. Is is >> possible using this installation of Emacs? >> >> As it is, any plots generated by commands that I type are sent by >> default to a file called Rplots.ps in the working directory. But for >> an interactive session, this is not so useful. >> >> Is there a way to coerce these graphics to open up in this or another >> application? >> >> Thanks, >> Nick >> _______________________________________________ >> macemacsjp-english mailing list >> macem****@lists***** >> http://lists.sourceforge.jp/mailman/listinfo/macemacsjp-english > > _______________________________________________ > macemacsjp-english mailing list > macem****@lists***** > http://lists.sourceforge.jp/mailman/listinfo/macemacsjp-english