Clicking on a plot in Octave closes Octave - plot

I just downloaded Octave today and I have used a little bit of Matlab. I am working on a machine learning problem and one of the things I wanted to do was opening a JPEG file in Octave as a matrix.
I = imread('nameOfTheFile.JPEG');
imshow(I)
This opens a figure with the image I was looking at. I clicked on the image out of habit and the figure closed along with Octave. I'm not sure why and it seems very inconvenient. Can anyone help me?
Thanks!

Related

Show plot on R-Studio terminal

do you guys know how to display an R plot in a terminal/console instead of showing it on plot viewers?
I've recently working to integrate R with external tools, and somehow the only function works is to returns all the value shown up in the console result. Thus, I need some sort of workaround to be able to post a plot in the external tools.
Thanks in advance!
No. That is not possible. The reason is that the plot needs a graphic device.
The terminal (and R console) is a text-based device.
What you can do, is use the image-format files as graphic device. Here, you have a multitude of choices, such as PNG, BMP, JPEG. In R, look up ?png.

Converting rectangular pixels to square pixels in R

I'm working with an asc file in R and trying to run it through some GIS processing on a script that was written by someone else. The current chunk of code I'm working on is
asc <- (raster(inputRas))
asc.extent <- extent(asc)
head <- read.ascii.grid.header(inputRas)
writeRaster(asc, "outputRas", format="SAGA", overwrite=TRUE)
which works until the last line. It's failing here because my raster is in rectangular coordinates, which SAGA doesn't like. I've spent a lot of time googling and trying different functions, but nothing has worked that didn't cause other problems down the line. I considered using projectRaster() for a while because the resolution can be changed within it, but I don't actually want to change the projection. Any help would be appreciated, thanks.
Instead of raster::projectRaster, you can use raster::resample

SVGAnnotation to create tool tips for each value in R heatmaps

I'd like to create a heat map in R that I want to use on a website. I stumbled upon the SVGAnnotation package which seems to be very nice to process SVG graphics in R to make them more interactive. First, I was planning to add tool tips for each cell in the heatmap - if the user hovers over the cell, the value of this cell should pop up. However, I am fighting with SVGAnnotation for more than 3 hours now, reading and trying things, and I can't get it to work.
I would appreciate any help on the SVGAnnotation tool tip function. But I would also very much appreciate alternatives to SVGAnnotation to add some activity to my R SVG heatmap.
So, what I have got so far looks like this:
library(SVGAnnotation)
data(mtcars)
cars <- as.matrix(mtcars)
map <- svgPlot(heatmap(cars))
addToolTips(map, ...) # problem
saveXML(map, "cars.svg")
My problem is the addToolTips function itself, I guess. Intuitively, I would simply insert the data matrix, i.e., cars, but this does not work and R gets stuck (it's calculating, but doesn't return anything, I waited 50 minutes)
EDIT:
After some more online research, I found a good example of what I want to achieve: http://online.wsj.com/article/SB125993225142676615.html#articleTabs=interactive
This heat map looks really great, and the interactive features (tool tips) work very well. I am wondering how they did that. To me, it looks like the graphic was done in R using the ggplot package.
I wrote a command line tool that can do exactly that if you are still interested to add tool tips to your heat map. It runs in Windows/Linux/MacOS terminals. All you need as input is the heat map as svg file and the data table/matrix that you used as input to create your heat map as csv or other text file.

Publishing a rgl interactive 3d plot to the web

I'm looking to see if something is possible, or some ideas if it isn't...
I've used the rgl package to generate an interactive 3d plot that you can rotate to look at the data from different angles.
I would like to be able to somehow publish this (or something similar) to the web to allow other to log on to the site and interact with the graph. Is this sort of thing possible?
I was playing around with the gWidgetsWWW package before which lets you use R as the back end of a website, but I'm not sure if this would be able to embed something as advanced as an RGL plot.
Ideally this would be on the web, but it doesn't have to - i.e. if it was possible to package the actual plot in some format and send it on to people.
Are there any ways to achieve this or can anyone think of a better approach? (Are there any non-R solutions I could look into that would give the same sort of output as rgl?)
Let me know if you need any more info. Thanks!
Looks like vrmlgen might help, but you probably need to have a VRML viewer application in your web browser. VRML was the new hotness about 15 years ago, but vrmlgen is only a few years old at most...
http://www.jstatsoft.org/v36/i08/paper
Some of the answers to this SO Q might help too:
3D visualization in browser

Is there a way to replace the legend or axis without redrawing the whole plot?

Sometimes I will place a legend at a particular location on the plot, let's say topright, and then I see that it covers an important part of the plot. Is there a way I can switch it to topleft or some other place without having to run all the other commands first? Sometimes I have the same problem with the axes, I misspell a word and then I have to issue all the commands again.
I eventually place everything in an R script which means this becomes less of a problem, but sometimes I want to quickly test something in console. Please tell me I have overlooked a basic command that does this.
There is no such thing, but you're on the right track - a script is definitely the way to go. I would also recommend R Studio, a free R IDE, which gives you several displays, one for scripts, one for the console, one for your plots - it's great! It makes working with scripts as easy as interacting with the traditional R console.
As Gabriel told you, a script is the best way. However, the following link could help you:
Using Inkscape to Post-edit Labels in R Graphs

Resources