Impressive!
> SageMathCell now defaults to producing SVG plots in R and displays all > automatic plots that it can (BMP, JPEG, PNG, SVG). Users are free to start > new plotting devices, pass any options to them, and create multiple plots > in the same cell. Plots with custom names or harder formats like PDF will > be provided as links only. With SageMathCloud approach you cannot change > format and changing options is done not from R code using R commands, you > are also limited to a single plot displayed automatically. The code above > does not show any plots at all in the cloud. > > What had to be done: > 1) R interface is recreated after each forking (via "r=R()" command) to > make sure that a new working directory is picked up. Would be great if > interfaces followed changing directories of the main process, but I don't > know how feasible that is. > 2) There is site configuration file installed into R in Sage setting two > options including default graphing device SVG. In Sage R interface is > prohibited from picking up configuration from anywhere and device is forced > in addition - I had to change it and I think it makes a lot of sense to > change it for Sage itself. > 3) After each R cell is executed, all graphic devices are now closed and > plots with default R names are shown automatically if possible. (Everything > else gets a link to.) R plots produced not in "R cells" will be always > linked to only, without auto display - this is similar to cloud showing > plots only if r-decorator was used. > > Andrey > > On Monday, 26 October 2015 10:27:23 UTC-6, William wrote: >> >> On Mon, Oct 26, 2015 at 7:39 AM, kcrisman <[email protected]> wrote: >> >> >> >> >> >> I wish to be able to plot in Octave/R inside a sagecell. >> >> Therefore, I just set up a sagecell server using the instructions here >> >> https://github.com/sagemath/sagecell >> >> >> >> >> >> I compiled my own sagecell server because when you use >> >> https://sagecell.sagemath.org >> >> you get the following when trying to plot in R: >> >> "Error in png() : X11 is not available" >> >> >> >> >> https://sagecell.sagemath.org/?z=eJwryMkv0UjWMNRRMNZRMNNRMNFRsNTUBABEDAT8&lang=r >> >> >> and in Octave you only get a Ascii plot >> >> >> https://sagecell.sagemath.org/?z=eJwryMkv0Yg21DGM1QQAFu8DVw==&lang=octave >> >> >> >> Using my own server plotting in R gives me nothing >> >> (not even "Error in png() : X11 is not available") >> >> and Octave still gives me only Ascii. >> >> >> >> I have two related questions: >> >> 1. Is it possible to get R plots in sagecell? >> >> >> > >> > It should be. >> http://www.dan-erik.com/phdblog/2013/05/using-sage-with-r/ >> > might be helpful. >> > >> > But http://statisfactions.com/2013/interactive-r-code-widget/ used to >> work >> > and doesn't any more, so that doesn't bode well. Andrey, did you maybe >> use >> > a version of Sage compiled without png support for R? Unfortunately >> even >> > the comment on that page no longer works. >> > >> > The graphics work with >> > pdf("Figname.pdf") >> > plot(...) >> > dev.off() >> >> Requiring the user to actually do that is a disaster regarding >> usability. In SageMathCloud I just make it automatic. E.g.,doing >> this just works: >> >> %r >> cars <- c(1, 3, 6, 4, 9) >> plot(cars, type="o", col="blue") >> title(main="Autos", col.main="red", font.main=4) >> >> See: >> >> >> https://cloud.sagemath.com/projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/files/support/2015-10-26-092322-r-plot.sagews >> >> >> I don't think I've done the analogous thing for Octave yet, but should. >> >> The way it works is by making %r *slower* when used interactively, by >> having it check to see if a new graphic was created each time it runs, >> and if so, displaying it. The codes all open source. Sage Cell >> server should be changed to do the same, in my opinion. However, >> leave the sage library's r.eval itself alone, since doing the above >> would slow it down. >> >> William >> >> >> -- >> William (http://wstein.org) >> > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
