R ubuntu evince - r

Is there any way out here?
Evince is the standard PDF viewer of Ubuntu. The immensely popular platform for statistics, R, started its life as a Linux package. But when I do a plot in R -- vanilla, no frills, no user options -- and save it to PDF, I can never see axis labels, titles etc. In evince, even though they appear in every possible viewer (Acrobat, Foxreader, Sumatra, qpdfview) on any OS. I have included qpdfview as default in memeapps.list, but when I double-click a PDF file, I get evince. Is there any help except uninstall evince (which I don't want to do as it helps with other file formats).

Related

Octave -- Plotting from Terminal Command Line

Background:
I'm new to Octave, as of today.
I am running GNU Octave, version 4.0.2 on Ubuntu 16.04 LTS
I'm using the command-line interface at the terminal (ie, open the terminal and, type "octave").
I'm aware that there is a GUI, but I want to see if I can get this working in the terminal [such a setup is my preference in most applications]
PROBLEM:
Plots are plotted in text. As in:
How can I get a good-looking plot in a plotting window? I genuinely haven't been able to find this information in 10 minutes of Googling...I think it should be easier than that....maybe someday this post will be the easy solution for others.
Best,
-Ryan
I personally do this a lot; it looks like you have it installed in a *nix environment... Octave can produce nice looking figures through cooperation with a couple graphic toolkits, GNUPlot being the one i'm more familiar with.
Check out the documentation at: https://www.gnu.org/software/octave/doc/v4.0.1/Plotting.html
Without seeing your code we're kind of just guessing. I would try something like
figure();
to see if you get a fresh plot window, or try
available_graphics_toolkits()
to ensure that you actually have something installed to generate separate figures.

R tcltk: error when trying to display a png file depending on the OS

This is an issue I am encountering for different pieces of codes I am writing in R.
Basically, I would like to generate a window that displays a picture (a .png file). Following for instance guidances from this or this, I come up with this kind of code:
library(tcltk)
tmpFile <- tempfile(fileext = ".png")
download.file("https://www.r-project.org/logo/Rlogo.png", tmpFile)
tcl("image","create","photo", "imageLogo", file=tmpFile)
win1 <- tktoplevel()
tkpack(ttklabel(win1, image="imageLogo", compound="image"))
This works fine under Mac OS, but not on Linux nor on Windows, where I am displayed such an error message:
[tcl] couldn't recognize data in image file
I can find some workarounds when I want to display graphs, using for instance packages tkrplot or igraph. Nonetheless, I would be really eager to understand why I got such errors when running my scripts on Linux or Windows, whereas it works just fine on Mac OS.
Apologies in case this issue is obvious, but I haven't found anything about potential differences with the tcltk package depending on the OS.
Tk's native support for PNG was added in 8.6. Prior to that, you need to have the tkimg extension loaded into Tk to add the image format handler required. If your installation of Tcl/Tk that R is using is set up right, you can probably make it work with:
tclRequire("Img")
once you've initialised things sufficiently. Yes, the name used internally is “Img” for historical reasons, but that's just impossible to search for! (This is the key thing in this mailing list message from way back.)
However, upgrading the versions of Tcl and Tk to 8.6 is likely to be a better move.
Finally and a bit lately, I would like to close this issue and sum up the different suggestions that were kindly made in response of my question:
R comes along with Tcl 8.5, even with the latest version 3.3.2, which means that there is no way for embedding a PNG file with the usual command into a window created thanks to Tcl/Tk. For some reasons it is working on Mac OS, but do not expect this to work easily on other OSs.
In order to display pictures, graphs, etc. in a window generated by Tcl/Tk in R, better look for either using the GIF support (when possible) or trying alternative solutions (see the question for possible alternative options).
In case one really wants to display PNG files, the solution consists of installing Tcl 8.5 (for instance ActiveTcl) along with the extension Img. In order to use the Tcl/Tk package that you've just installed on your computer, you can refer to the R FAQ for Windows for instance (as stated in the FAQ, you need to install Tcl 8.5 - I tried with Tcl 8.6, thereby hoping to solve my issue, but it didn't work). Basically, you need to set up an environment variable (MY_TCLTK) and put the path where the package Tcl/Tk is installed. Needless to be said, Tcl/Tk is commonly used in R in order to implement GUIs; if you have to go through very complex procedures to set up the system, the package definitely loses its advantages.
Finally, since Tcl 8.6 should be available soon or later with R (already implemented in the devel version), this issue will be de facto outdated.

Unable to get plots displayed in Rstudio graphical viewer.

When I run my code all my graphs (both ggplot2 and plot) are displayed in an external "Quartz 2 [*]" graphical viewer.
I would like them to be displayed in the R studio GUI plot area to I can better save and view my files, along with the previous versions.
Is there anyway to stop this?
I recently updated my version of R, along with the X11 and xQuartz on my mac (also up to date), and I am guessing these updates are behind it.
I have seen many forums explaining how to get rstudio to export to an external viewer (e.g. "quartz()"), but not the other way.
I have looked, but these threads have not helped:
ggplot plots in scripts do not display in Rstudio
plot panel does not produce plots Rstudio
dev.off() even when hidden hide <- dev.off() is not working either.
Any help would be great,
Thanks.
If you upgrade R without upgrading RStudio, the graphics engine may not be compatible. To fix the "Quartz 2" popout, upgrade RStudio to a newer version that supports the graphics engine in the version of R you have installed.
I had the same problem, and noticed the following output to the console:
Warning message:
R graphics engine version 15 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed.
Looks like I forgot to reinstall Rstudio as well.. That sorted my problem.

R Plot Auto-View

I'm trying to figure a way to automatically open the pdf-output of an R script after i run it. My goal is to integrate that into Sublime Text (under osx) to make something like an automatic viewer for my generated plots.
Any idea is welcome (obviously if there exists a plugin that already acts as a viewer for R, much better)

How do I get RStudio to publish R-markdown to the rpubs.org site?

According to a response from the RStudio team, the "standard" solution would be to follow the instructions for "Using R Markdown with RStudio", and notice the button on the third screenshot with the "Publish" button. A wonderfully simple solution that I'm quite grateful they have built.
However, the "Publish" button with the nice arrow and picture of the earth doesn't show up in my preview window, no matter how badly I want it to.
I am using RStudio (RStudio.version() 0.96.231) in Mac OS X Lion (10.7), with latest R version and updated markdown and knitr packages. I have an RPubs account, and have followed the RPubs instructions for creating and previewing the html rendered from an R markdown file from within RStudio.
This seems to be related to a post on the RStudio support blog about not-seeing a Publish button.
However, this question is different, as it requires actually getting content up onto RPubs. I have posted an analogous question on the RStudio Support blog.
The Rstudio team already answered how to get graphics embedded in html rendered by RStudio from R Markdown source; especially by pointing me to this extremely useful page explaining the way RStudio renders and packages R Markdown using knitr:
Using RStudio to render R Markdown
Finally, if you haven't heard about R-markdown (I just learned of it),
go here for details about R-markdown.
Confirmed by Josh Paulson at RStudio, this was a bug with RStudio in OS X Lion and not some weird extra set of unstated dependencies or unclear instructions.
Just install v0.96.233 or greater and this should work on Mac OS X Lion (10.7).
Actually, the implementation and instructions are quite straightforward.

Resources